Chapter 3
Indexing & Infrastructure
The heart of the search engine. This chapter demystifies the black box, explaining how inverted indices, BKD trees, and vector graphs actually work on disk.
In This Chapter
3.1 What is an Index?
Why we can't just `SELECT * WHERE text LIKE '%query%'`.
3.2 The Inverted Index
The data structure that makes full-text search O(1).
3.3 BKD Trees & DocValues
Handling numbers, dates, and sorting efficiently.
3.4 Vector Indices (HNSW)
Navigating high-dimensional space for semantic search.
3.5 Segments & Immutability
Why search engines are append-only and how merging works.
3.6 Sharding Architecture
Distributed storage: Shards, Replicas, and Routing.
3.7 Write Path vs Query Path
The lifecycle of a document vs the lifecycle of a request.