Design a Search Ranking System

Quick Overview

Design the ranking component of a search engine. Cover feature engineering from query-document pairs, learning-to-rank models, relevance scoring, freshness signals, and A/B testing the ranking pipeline.

Google
System Design
Software Engineer
Google
Software Engineer
Onsite
System Design
Hard

0


Design the ranking component of a search engine. Cover feature engineering from query-document pairs, learning-to-rank models, relevance scoring, freshness signals, and A/B testing the ranking pipeline.

This is a Google onsite system design question that centers on the ranking stage of search rather than crawling or indexing. The interviewer wants to see how you turn query-document pairs into features, train and serve learning-to-rank models within a tight latency budget, and prove improvements with careful A/B testing.

What the Interviewer Expects
  • Describe a multi-stage pipeline: candidate retrieval from the index, a cheap first-pass scorer, then a heavier learning-to-rank model on the top candidates
  • Name concrete query-document features (text relevance like BM25, link authority, click signals, freshness, document quality)
  • Explain learning-to-rank choices (pointwise, pairwise, listwise) and offline metrics like NDCG
  • Handle freshness for time-sensitive queries without hurting evergreen results
  • Lay out online evaluation with A/B tests and interleaving, plus guardrail metrics
  • Estimate QPS and the latency budget per stage
Key Topics to Cover
Learning to rank
Feature engineering
Multi-stage ranking
Freshness signals
NDCG and offline evaluation
A/B testing and interleaving
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How do you correct for position bias when using clicks as training labels?
  • How would you detect that a query is time-sensitive and boost fresh documents?
  • Your new model wins offline on NDCG but loses in the A/B test. How do you debug that?
  • How do you keep feature values consistent between offline training and online serving?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Functional Requirements

  1. Query Parsing: The system should be able to parse user queries to understand intent.
  2. Document Indexing: Efficiently index documents to allow for quick retriev...
Capacity Estimation

Given Google processes over 3.5 billion searches per day:

  • Queries per second (QPS): 3.5 billion / 86400 seconds = ~40,000 QPS.
  • Document Count: Assume 100 billion indexed documents.
  • **Dat...

Submit Your Answer
Markdown supported