The Search Odyssey
In progress
Module 3The data structure behind search Tokenizer

The Inverted Index

Tokenize text, build postings lists, run Boolean queries, and see why running shoes should match run and shoe.

TokenizationStop wordsStemmingPostings listsBoolean queriesPhrase queries

The stumper

Running shoes misses documents that say run and shoe.

An inverted index flips the usual document-centric view. Instead of asking what words a document contains, it asks which documents contain a word.

That simple inversion is the foundation of nearly every text search system. Tokenization breaks text into terms, normalization reduces variation, and postings lists record where each term appears.

Once the index exists, Boolean queries become set operations. Phrase queries become position checks. Ranking becomes a separate problem layered on top.

Try it before you read on

Open the Lab tab. Change a parameter, break something, and form a hypothesis before reading the explanation.

Checkpoint

3 questions. Explanations appear after submission.

1. What does a postings list store?

2. Why can stemming cause surprises?

3. What extra structure makes phrase queries possible?