AI system design interview: design AI search for an e-commerce catalogue

Interview questionLast reviewed Oct 16, 2026By Himanshu Ramchandani
Short answer

Use a small model to parse the query into structured filters (category, price, attributes) and free text, apply the filters exactly on product fields, and rank candidates with hybrid search: keywords for brands and model numbers, vectors for descriptive needs. Rerank with relevance plus business signals like stock and ratings under clear rules, cache common queries, and evaluate offline with labelled relevance and online with click-through, add-to-cart and zero-result rate.

Question

Make search understand queries like "waterproof hiking shoes under 5,000 rupees for wide feet".

Clarify

  • Catalogue size and how often it changes.
  • Latency target: search usually needs results in a few hundred milliseconds.
  • Product data quality: are attributes like "wide fit" structured or only in descriptions?

Architecture

Stage Component
Query understanding Small model or rules extract category, price range, attributes, free text
Filters Applied exactly on structured fields (price under 5,000, in stock)
Retrieval Hybrid: BM25 for brands and model numbers, vectors for "good for long hikes"
Reranking Relevance blended with stock, ratings and margin under explicit rules
Caching Parsed queries and results for common searches
Fallback Relax filters step by step instead of returning nothing

Deep dive: latency

An LLM call per search adds hundreds of milliseconds. Cache parsed queries (many searches repeat), use a small fine-tuned model or rules for common patterns, and fall back to plain keyword search if parsing times out.

Failure modes

Failure Mitigation
Attribute not in product data ("wide feet") Enrich product data offline with extracted attributes
Price parsed wrong Validate parsed ranges, show applied filters to the user
Zero results Relax filters in order, show what was relaxed
Business rules override relevance Separate, documented weights, tested offline

Evals

Offline: labelled query and product relevance, nDCG or recall at the first page. Online: click-through, add-to-cart, zero-result rate and revenue per search, through A/B tests.

What interviewers listen for

Exact filters from structured data, hybrid retrieval with a reason, and online metrics that reflect buying, not just clicking.

From the floor

In a live jam session with builders, one builder described the e-commerce agent they were working on: one part answers simple questions like the refund policy, and another handles requests like "I have a wedding in 6 days, what can you suggest?", which is the kind of descriptive need keyword search can't handle and structured filters alone can't express.

Sources