Design a Typeahead Autocomplete
Design the suggestion box under a search field. As a person types “new y”, the box shows the 10 most likely complete searches, such as “new york weather” and “new year’s eve”, and updates on every pause in typing. Choosing one runs that search. Suggestions are the same for everyone in a language and region, ranked by how often people searched them recently.
The search engine has 500 million daily users and 2 billion searches a day, and each search is about 12 keystrokes, so suggestions are asked for far more often than searches run: 600,000 keystrokes a second at peak. Every answer must arrive before the next key is pressed, within about 100 ms. It must also be fresh, so a breaking story shows within minutes, and clean, so it never suggests something offensive or private.
Good questions to ask first
Decide what you would assume for each before you look at ours.
- 1How many suggestions?
- 2Ranked by what?
- 3Personalised?
- 4Which languages?
- 5Do we correct typos?
- 6How fresh?
- 7What may never be suggested?
- 8How fast?
How to spend the 45 minutes
- 5minPart 1: Requirements and scope
- 5minPart 2: Estimates
- 5minPart 3: API
- 15minPart 4: Architecture, stage by stage
- 15minPart 5: Deep dives and trade-offs