Inverted indexes and postings
medium 4 minAn inverted index maps a term to ordered document identifiers.
Video lesson · Chapter 1 of 5
Three signs, two query words
Search three documents without opening them
1:10Reel
Theory
Read or listen first. About 1 min.
What it is
An inverted index turns the question around. Instead of examining each document for a term, it stores a sorted list of document IDs for each term.
Intersect two sorted posting lists
Why it exists
Intersecting two much shorter lists can settle a conjunction without reading the document bodies. Phrase matching needs the additional evidence of term positions.
Words to know
- Posting
- An index entry linking a term to a document, optionally with frequency or position information.
How it works
Step through the idea, or press Play.
Read postings. Reset gives 2, 4, 9. Token gives 1, 4, 9.
Understand it
Worked example
Inverted indexes and postings in practice
For reset in documents 2, 4, 9 and token in 1, 4, 9, an AND query intersects the postings to yield 4 and 9. Checking positions distinguishes the exact phrase from words scattered across a page.
Related case
Why did this document rank first?
An internal engineering search returns a long glossary above a precise two-paragraph runbook. Another user cannot find a document they just published.
Check refresh, terms and access filters.