Typeahead Autocomplete
Serve prefix suggestions from a fast, prefix-optimised index.
IntermediateWebData
User input is sent to an autocomplete service that queries a prefix index over the known corpus and returns a small ranked list, with the backing corpus and popularity signals updated asynchronously by batch jobs.
When to use it
- Users need instant suggestions while they type
- The corpus is much larger than the number of suggestions you want to show each query
Trade-offs
- Prefix index freshness can lag the latest content if updates are batched
- Ranking quality often needs separate relevance tuning from the storage engine
Components used
Web AppManaged App ServiceSearch IndexBatch / Scheduled JobObject Storage
How it works
- Suggestions are served from a prefix-optimised structure — a trie or an edge-n-gram index — rather than a wildcard database query.
- Popular completions are precomputed per prefix and cached, so a keystroke costs a lookup rather than a search.
- The client debounces input and cancels in-flight requests, since a user typing eight characters must not generate eight competing responses.
Used in the wild
- Search box suggestions on commerce and content sites.
- Address and location completion.
- Command palettes and in-app entity pickers.
Good to know
- The latency budget is roughly 100ms. Beyond that the suggestions arrive after the user has already typed past them, which feels worse than having none.
- Out-of-order responses are the classic bug: an earlier request returns after a later one and overwrites the correct suggestions with stale ones. Sequence numbers or request cancellation are required.
Related system design
Ad Click Aggregation & Analytics
Ingest high-volume click events and aggregate them for billing and reporting.
URL Shortener
Create short aliases, then redirect quickly from a cache-backed read path.
Pastebin / Snippet Hosting
Store snippets as text or markdown, retrieve them by id, and optionally render preview.
Web Crawler / Search Indexer
Discover pages, crawl them, extract content, and index for search.