# Design a search autocomplete system: system design interview question

> Query suggestions under heavy traffic, with changing popularity and strict controls on which phrases can appear.

Source: https://sysround.com/questions/design-search-autocomplete-system
Updated: 2026-11-05


Difficulty: hard. Levels: Senior, Staff+.

## How the interviewer opens it

"Design a search autocomplete service. It suggests query completions as users type. It must respond quickly and reflect changes in query popularity."

## What to clarify first

- Result behavior
- Traffic
- Read and write mix
- Corpus and locales
- Latency
- Relevance and freshness
- Consistency and availability
- Durability
- Phrase eligibility and safety
- Scope limits

## Scope of a strong answer

Core requirements:

- Return up to ten query completions that match a prefix and a locale.
- Reflect significant popularity changes within five minutes.
- Admit new phrases after they pass eligibility checks.
- Stop suggestions for a blocked phrase within 60 seconds.

Usually out of scope:

- Return search results.
- Build the safety review system.
- Support ads or sponsored suggestions.
- Complete text from documents that users did not submit as queries.

## What interviewers probe

### Results for short prefixes

A short prefix can match millions of phrases. The service must return relevant results without work that grows with every match.

### Changes in query popularity

Popularity can rise or fall before the next full refresh. Previous winners alone do not contain every phrase that should replace them.

### Updates during failures

Servers can receive different updates during a failure. Recovery must preserve complete results without losing changes or restoring stale safety decisions.

### Queries that must not appear

New phrases have no approved identity yet. Admission must count users across a rolling window without exposing private text or bypassing safety decisions.

## Common mistakes

- Count keystrokes as popularity events.
- Scan and sort all matching phrases for every request.
- Store large candidate lists at every prefix without estimating memory.
- Change scores without finding new candidates after previous winners fall.
- Sum distinct users across time buckets without removing duplicate users.
- Treat cached results as exempt from safety blocks.

## The bar by level

- **Senior:** Meets latency and freshness targets with bounded reads. Handles score decreases, replacement candidates, event retries, rolling user counts, and safety blocks.
- **Staff+:** Defines recovery across regions and partial updates. Proves candidate completeness and score authority. Quantifies index and admission costs. Preserves safety deadlines during outages.

Practice this question with an AI interviewer: https://sysround.com/practice/new?problem=search-autocomplete


---
SysRound (https://sysround.com) is an AI practice tool for system design interviews. It has a voice or typed AI interviewer and a shared whiteboard. At the end, you get feedback on each skill and a model answer. The AI feedback can be wrong.
