Search Autocomplete
Answer every keystroke within milliseconds. Covers prefix lookups, precomputed suggestions, the pipeline that builds them from query logs, and how to keep the results fresh and safe.
Lessons
- 01Define a useful suggestionDecide what a prefix may match, who sees the result, and how quickly it must appear.
- 02Count requests, not just searchesOne typing session can generate many reads, while completed searches become ranking signals.
- 03Find candidates by prefixNarrow the candidate set before ranking it.
- 04Rank the top fewTurn frequency counts into a stable ordering with explicit guardrails.
- 05Build from completed searchesAggregate events away from serving and publish a versioned read model.
- 06Serve a predictable read pathKeep lookup short while handling misses and regional context deliberately.
- 07Split hot and large indexesPartition by observed load and replicate hot slices.
- 08Keep suggestions trustworthyTreat bad suggestions, private data, and stale builds as operational failures.