Interview's MateSystem Design
Interview's Mate

System Design

Architecture & trade-offs

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
All topics/Search & Inverted Indexing
STORAGE, CACHING & SEARCH · SUBTOPIC

Inverted Index & BM25 Ranking

How search engines tokenize text, intersect posting lists, and rank relevance.

IntermediatePart of Search & Inverted Indexing
Practice in AI HLD
Subtopics in Search & Inverted Indexing (2)
OverviewInverted Index & BM25Tries & Vector Search

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
Parent topic
Search & Inverted Indexing
Next subtopic
Typeahead Tries & Vector Semantic Search