InterviewDryRun
System design interview · Asked at mid and senior level

Design Search Autocomplete

How the interviewer asks it

“Design the type-ahead suggestions for a search box used by millions of people.”

Want the full answer? Watch lesson 9 of the free system design course: a 22-minute video walkthrough of this question.

Typed drills are free and unlimited: the AI scores your answer against the outline below.

What the interviewer is looking for

  • A latency budget (suggestions in under about 100 ms) that shapes every choice.
  • A trie or prefix index where each node stores its precomputed top suggestions.
  • Suggestions built offline from query logs on a schedule, not updated on every search.
  • Client-side debouncing and caching of prefixes.
  • Filtering of offensive or unsafe suggestions.

How to structure your answer

  1. 01

    Requirements

    Top 5 to 10 suggestions per prefix, ranked by popularity, fast, freshness within hours.

  2. 02

    Data collection

    Log searches, aggregate counts per query in a batch or streaming job.

  3. 03

    Index

    Build a trie where each node holds its top-k completions; serialise and shard it by prefix.

  4. 04

    Serving

    Stateless servers load the trie in memory; a cache and CDN hold hot prefixes.

  5. 05

    Client

    Debounce keystrokes, cancel in-flight requests, cache prefix results in the browser.

  6. 06

    Updates

    Rebuild periodically and swap atomically; a small real-time layer for trending queries.

Best answers from candidates

No candidate answers yet. Type yours, and if it scores 6 or more you can show it here without your name.

Answers are shared by candidates, without names, after a privacy check. Add yours

Common mistakes

  • Querying the main database with LIKE 'prefix%' on every keystroke.
  • Computing top-k at request time by walking the whole subtree.
  • No plan for personalisation or for removing a bad suggestion fast.

Follow-up questions to expect

  • Support multiple languages and typo tolerance.
  • A news event makes a new query trend within minutes.

Now answer it out loud

Max will ask you this exact question, listen to your answer, push on the weak spots with follow-ups like the ones above, and score you when you finish.

Practice with Max

Free: a 5-minute voice round and unlimited typed drills, with scored feedback. No card, and your camera is never recorded.

More system design interview questions

Preparing for this round? Read how to practice for a system design interview.