Design typeahead across client state and backend retrieval, including matching, ranking, cache keys, stale-response protection, permissions, and latency evaluation.
Design a typeahead search experience. As a user types, return useful suggestions with low perceived latency and explain how frontend request handling fits the backend retrieval design.
### Constraints & Assumptions
The source names typeahead and notes possible short coding follow-ups, but gives no specific domain or algorithm. State candidate data, matching rules, personalization, and freshness requirements before sizing the system.
### Clarifying Questions
Are suggestions queries, products, people, or documents? Is matching prefix-only or tolerant of spelling errors? What ranking and access-control rules apply? How much update delay is acceptable?
### What a Strong Answer Covers
An API, retrieval/index choice, ranking, caching, request cancellation or stale-response protection, and evaluation of latency and usefulness.
### Follow-up Questions
Why can debouncing alone still show stale results? What belongs in a cache key? How would you support a changing corpus or permission-restricted suggestions?
Overview: Design typeahead across client state and backend retrieval, including matching, ranking, cache keys, stale-response protection, permissions, and latency evaluation.
Design a typeahead search experience. As a user types, return useful suggestions with low perceived latency and explain how frontend request handling fits the backend retrieval design.
Constraints & Assumptions
The source names typeahead and notes possible short coding follow-ups, but gives no specific domain or algorithm. State candidate data, matching rules, personalization, and freshness requirements before sizing the system.
Clarifying Questions Guidance
Are suggestions queries, products, people, or documents? Is matching prefix-only or tolerant of spelling errors? What ranking and access-control rules apply? How much update delay is acceptable?
What a Strong Answer Covers Guidance
An API, retrieval/index choice, ranking, caching, request cancellation or stale-response protection, and evaluation of latency and usefulness.
Follow-up Questions Guidance
Why can debouncing alone still show stale results? What belongs in a cache key? How would you support a changing corpus or permission-restricted suggestions?