Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Shopping Search Bar

Design a shopping search bar that serves low-latency query suggestions and relevant product results while catalog and popularity data change continuously.

Problem statement

For this exercise, assume a marketplace search bar serves two related experiences: typeahead suggestions as a shopper types, and product results after submission.

Suggestions may come from normalized catalog phrases and aggregated popular queries; results search active product documents with text relevance, filters, and availability. Catalog changes and removals stream continuously into both indexes.

A removed or policy-blocked product must stop appearing within a bounded interval, while popularity ranking may be eventually consistent.

The design may use a trie-like in-memory suggestion structure and a distributed inverted search index, but should explain ownership, update flow, caching, and failure behavior rather than rely on product names. Personalization, ads, checkout, image search, and seller listing creation are out of scope.

What to build

  1. A shopper can request deterministic, ranked suggestions for a normalized prefix and locale while typing.
  2. A shopper can submit a query and receive relevant active products with filters and pagination.
  3. Catalog creates, updates, removals, and policy blocks propagate to suggestion and product indexes with versioned replay semantics.
  4. The service exposes degraded, stale, or partial behavior when an index, shard, or update pipeline is behind.

At scale

  • The marketplace has 50 million active products and 20 million normalized suggestion phrases across supported locales.
  • Peak traffic is 1 million typeahead requests per second and 200,000 submitted searches per second; typeahead should finish within 100 ms p95 and product search within 300 ms p95.
  • Catalog additions should normally be searchable within 60 seconds; removals and policy blocks must disappear from results and suggestions within 30 seconds.
  • The service should remain useful during a single shard or region failure while marking partial results and avoiding silently serving entries past the removal bound.