STORAGE, CACHING & SEARCH · SUBTOPIC
Inverted Index & BM25 Ranking
How search engines tokenize text, intersect posting lists, and rank relevance.
IntermediatePart of Search & Inverted Indexing
Subtopics in Search & Inverted Indexing (2)
In plain words
Instead of reading every page of 1,000 books to find "dragon", a search engine flips to the back index under "D → dragon: p.14, p.89" and jumps straight there.
Think of it like…
The index at the back of a textbook.
Loading interactive diagram
Loading interactive exercise
Theory & how it works
What BM25 scores
BM25 gives higher scores when a query word appears multiple times in a short field (like a title), gives more weight to rare words ("k8s" beats "the"), and normalizes for document length so massive essays don’t unfairly beat concise answers.
Key points & practical guide
Summary checklist
- Tokenization normalizes case, stems ("running"→"run"), drops stopwords
- Posting lists enable fast boolean AND/OR intersections
- Sync DB → Search asynchronously via CDC or queues (Elasticsearch is not your primary source of truth)
When to use it
- Product search, log search, document search, filters + facets
Watch out for
- Treating Elasticsearch as the sole primary database without a durable DB backup
Quick check
Loading quiz