Apache Lucene
maang.io System Design Series
Apache Lucene is the engine inside Elasticsearch and Solr. Its heart is the inverted index — a map from each term to the list of documents containing it — built through an analysis pipeline (tokenize, lowercase, stem) and stored in immutable segments. Add BM25 relevance scoring and you have the machinery behind fast, ranked full-text search.
This deep dive comes in three parts:
- Foundations & Core Concepts — the inverted index and the analysis pipeline.
- Internals — segments and merging, the term dictionary (FST), postings, and BM25 scoring, with worked numbers.
- Interview — Staff/Principal Q&A: how search really works and relevance tuning.