Design a Typeahead Suggestion System

Quick Overview

Design typeahead with prefix indexing, ranked completions, caching, controlled index updates, text consistency, and protection against stale client responses.

Design a Typeahead Suggestion System

Company: Pinterest

Role: Software Engineer

Category: System Design

Difficulty: easy

Interview Round: Onsite

Design a typeahead system that suggests completions as a user types. Begin by clarifying the suggestion corpus, matching and ranking behavior, freshness needs, and expected query load; the interview source specifies the system-design topic without fixed constraints. Explain both the serving path and how the suggestion index is built and updated. ### What a Strong Answer Covers - A clear distinction between finding eligible completions and ranking them. - An index suited to prefix lookup and a bounded response. - Caching, distribution, hot prefixes, and index updates. - Consistent text handling and client behavior when requests complete out of order. - Evaluation of usefulness, latency, and stale or inappropriate suggestions. ### Follow-up Questions - What changes when a popular suggestion must disappear immediately rather than wait for the next index rebuild? - How would you prevent a response for an older prefix from replacing suggestions for the user's current input?

Overview: Design typeahead with prefix indexing, ranked completions, caching, controlled index updates, text consistency, and protection against stale client responses.

|Home/System Design/Pinterest
Pinterest logo
Pinterest
Aug 22, 2026
easySoftware EngineerOnsiteSystem Design
1
0

Design a typeahead system that suggests completions as a user types. Begin by clarifying the suggestion corpus, matching and ranking behavior, freshness needs, and expected query load; the interview source specifies the system-design topic without fixed constraints.

Explain both the serving path and how the suggestion index is built and updated.

What a Strong Answer Covers Guidance

  • A clear distinction between finding eligible completions and ranking them.
  • An index suited to prefix lookup and a bounded response.
  • Caching, distribution, hot prefixes, and index updates.
  • Consistent text handling and client behavior when requests complete out of order.
  • Evaluation of usefulness, latency, and stale or inappropriate suggestions.

Follow-up Questions Guidance

  • What changes when a popular suggestion must disappear immediately rather than wait for the next index rebuild?
  • How would you prevent a response for an older prefix from replacing suggestions for the user's current input?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...