Course contentsShow
← System Design
Lesson 1742 of 1,91942. Real-World System: Search and TypeaheadFree lesson

Search System Architecture Overview

High-level architecture with indexers, query servers, distributed indexes, and caching layers for scalability.

Search System Architecture Overview

What you'll learn: How the major components of a modern search engine work together to index billions of documents and serve queries in milliseconds.


The Complete Picture

A production search system isn't a single monolithic service—it's a carefully orchestrated collection of specialized components working in parallel. Think of it like an orchestra where indexers prepare the music sheets (inverted indexes), query servers perform the symphony (process searches), distributed indexes hold the sheet music across multiple stands (sharding), and caching layers act as the conductor's memory (avoiding repeated work).

Core Architectural Layers

Indexing Pipeline

Indexers continuously process crawled documents, perform tokenization and text analysis, build inverted indexes with posting lists, and push completed index segments to storage. These run as background batch jobs, often processing terabytes of data daily.

Query Serving Layer

Query servers (or "search servers") receive user queries, parse them using boolean operators, fetch relevant posting lists from indexes, compute TF-IDF or other scoring functions, rank results, and return the top matches—all within 100-300ms.

Distributed Index Storage

With billions of documents, a single machine can't hold everything. Indexes are sharded (partitioned by document ID ranges or hash) across hundreds or thousands of machines. Query servers scatter requests to all relevant shards, then gather and merge results.

Caching Layers

Multi-level caches dramatically reduce latency:

  • Query result cache: Store complete results for popular searches
  • Posting list cache: Cache frequently accessed index segments
  • Document metadata cache: Keep titles and snippets in memory

Why This Architecture Scales

The architecture separates concerns: indexers work offline and can lag behind real-time, while query servers focus purely on speed. Horizontal scaling adds more query servers and index shards independently.

Key Takeaway: A scalable search system separates indexing (write path) from querying (read path), distributes indexes across shards, and leverages aggressive caching to meet strict latency requirements at massive scale.