Skip to main content
Kuldeep Singh
Kuldeep SinghDigital Architecture
SALESFORCE · SEARCH ARCHITECTURE · RUST · TYPESCRIPTRole: Principal Systems Architect

Building Search for High-Volume Salesforce Experiences

Fast retrieval without forcing the UI to become the search engine.

Fast retrieval without forcing the UI to become the search engine.

RUSTTYPESCRIPTSEARCH ENGINELWC
01 // The Constraint

What Made the Problem Difficult

Enterprise quoting, asset discovery, and multi-dimensional catalog configuration require users to filter across hundreds of thousands of location nodes, component specifications, and commercial attributes in real time.

Core Platform Constraint

Direct database querying via SOQL on high-volume tables triggers severe table-scan locks, index non-selectivity errors, and governor limit ceilings. Conversely, dumping large datasets into the browser turns the client JavaScript thread into an overburdened, fragile search engine.

Boundary Invariants & Operational Limits:
  • !Search queries must return targeted results with sub-second responsiveness directly into native Salesforce LWC
  • !Zero governor limit exhaustion or table-scan timeouts on high-volume platform database objects
  • !Strict separation between search index computation and browser client resources
  • !Do not fabricate index sizes, query latency numbers, benchmark results, or ranking formulas without verification
02 // The Architecture

What System Was Designed

Architected a specialized dual-engine search topology tailored for high-volume Salesforce workflows. High-throughput indexing and deep multi-attribute retrieval are handled by a dedicated Rust search engine service. A complementary TypeScript search engine provides agile, lightweight in-memory filtering and client/edge query resolution. Only precisely targeted, hydrated result records return to the native LWC interface, keeping the browser view lean and responsive.

03 // The Key Decision

Pivotal Architectural Choices

Key Architectural Decisions

ADR // 01DETERMINISTIC CHOICE

Dual Specialized Search Engines (Rust + TypeScript) vs. CRM SOQL Queries

Context:

CRM transactional databases are engineered for ACID consistency, not multidimensional inverted index searching.

Alternatives Evaluated:
  • Complex SOQL queries with wildcards and formula fields
  • Third-party SaaS search iframe embeds
  • Full client-side JavaScript array scanning
Chosen: Rust search engine for heavy inverted index throughput combined with TypeScript engine for agile edge evaluation.

Aligns computational demands with specialized tools: Rust provides unmatched memory safety and raw indexing speed, while TypeScript delivers seamless edge integration.

ADR // 02DETERMINISTIC CHOICE

Targeted Result Hydration vs. Full Record Streaming

Context:

Transferring thousands of unneeded record fields across the wire degrades both network transit and browser rendering.

Alternatives Evaluated:
  • Streaming full records on every filter change
  • Naive pagination with full record payloads
Chosen: Search engines return minimal ranked record identifiers; only visible display rows are hydrated in LWC.

Keeps network payloads tiny and guarantees instant DOM rendering even when querying massive underlying datasets.

04 // The Engineering

What Was Actually Built

01

Engineered a high-performance Rust search engine compiling tokenized inverted indexes for multi-attribute matching.

02

Developed an in-memory TypeScript search module executing rapid fuzzy matching and category filtering on active subsets.

03

Constructed a workload distribution router classifying query complexity and dispatching to the appropriate engine.

04

Implemented a targeted retrieval protocol delivering strictly bounded response payloads to native Salesforce LWC.

05 // The Trade-offs

Deliberate Architectural Compromises

Trade-offs & Mitigations

External Specialized Search Index vs Standard Salesforce Search (SOSL)

Architectural Benefit:

Sub-second response times, complex multidimensional filtering, and zero consumption of CRM search limits.

Associated Cost:

Requires an asynchronous synchronization stream to keep external indexes aligned with Salesforce CRM updates.

Mitigation Strategy:

Utilized Change Data Capture (CDC) platform event streams to update search indices asynchronously on record changes.

Compiled Rust Service Maintenance vs Single-Language Node.js Stack

Architectural Benefit:

Predictable near-zero memory overhead and exceptional concurrency under heavy catalog query loads.

Associated Cost:

Requires maintaining a compiled Rust service alongside TypeScript web application stacks.

Mitigation Strategy:

Encapsulated Rust binaries behind clean, contract-first API boundaries.

06 // The Result

Verified Outcomes

✓ VERIFIED RESULT

Enabled lightning-fast, multi-attribute catalog search for high-volume Salesforce users without UI freezes

✓ VERIFIED RESULT

Shielded Salesforce CRM from costly full-table scans and query limit timeouts

✓ VERIFIED RESULT

Delivered targeted result sets directly into native LWC interfaces with zero browser memory strain

✓ VERIFIED RESULTRequires Benchmark Confirmation

Query latency, index throughput, and catalog capacity benchmarks: [VERIFY WITH KULDEEP]

07 // Architecture Blueprint

System Schematic & Data Flow

System Topology Blueprint
Dual Rust & TypeScript Search Engine Architecture
INTERACTIVE SCHEMATIC
NATIVE LIGHTNING WEB COMPONENT INTERFACECatalog Explorer & High-Volume Filter ControlsSingle-keystroke debounced query ingress · Zero browser-side table scanQUERY ROUTER & WORKLOAD DISTRIBUTORIntent Classification & Dual-Engine Query DispatchRUST COMPILED SEARCH ENGINEHigh-Throughput Inverted IndexMulti-attribute catalog index & spatial matchingZero garbage-collection pauses · Memory safetyTYPESCRIPT IN-MEMORY ENGINEDynamic Client & Edge EvaluationContextual filtering & session attribute rankingLow-overhead evaluation · Instant responsiveness
DECOUPLED RETRIEVALShields Salesforce CRM from expensive full-table scans and query timeout limits.
RUST PERFORMANCEUnmatched memory efficiency for multi-hundred-thousand record catalog indices.
TARGETED HYDRATIONOnly precise, ranked record pointers return to the LWC view layer.

High-throughput Rust engine handles deep indexing while TypeScript engine performs agile dynamic filtering, returning targeted results to native LWC.

Text alternative for screen readers: Architecture flow: Native LWC Interface to Query Workload Router via Debounced Query Ingress; Query Workload Router to Rust Search Engine via High-Volume Inverted Index; Query Workload Router to TypeScript Search Engine via In-Memory Dynamic Filter; Search Engine Core to Native Salesforce UX via Targeted Result Hydration

08 // Why It Matters

Architectural Conclusion

Fast retrieval without forcing the UI to become the search engine.

Key Lessons for Platform Scale:
  • Never force a relational transactional CRM database or a browser UI to perform the job of a specialized search engine.
  • Designing dedicated search infrastructure that feeds clean, targeted results back into native platform experiences provides the best of both worlds: extreme speed and seamless user familiarity.