Prefix data structure

Trie or FST (Finite State Transducer). Given prefix, walk to node, collect descendants. Millisecond even at millions of entries.

Advertisement

Prefix data structure

Trie or FST (Finite State Transducer). Given prefix, walk to node, collect descendants. Millisecond even at millions of entries.

Advertisement

Debounce on client

Send suggest request after 50ms of no typing. Avoids sending 5 requests for 'hello'. Server-side cost drops massively.

Ranking = popularity + personal

Global popularity (click counts) blended with personal history. Recent queries + geo-context weighted.

Spell correction

Edit distance model catches typos. 'goolge' → suggests 'google'. Weighted by keyboard proximity.

Safety filter

Bad words, blocked queries, PII scrubbed before results returned. Compliance-critical for consumer apps.