Reading every page
no index257 pages read
Every page, to find the 6 that say it.
Module 26 · Search before AI
Before chatbots, search was an index: a list of the pages each word is on. Here you build Larkspur’s, score its results and find where matching words stops being enough.
The whole idea in one example
257 pages read
Every page, to find the 6 that say it.
1 drawer
Its list names the same 6 pages, none read.
Pages are RAG’s 32-word pieces of Larkspur’s documents, searched as the page builds: a teaching search box, not any search engine’s numbers.
How it works
An index lists the pages each word is on
Apache Lucene’s documentation: its terms index is an inverted index, because it can list, for a term, the documents that contain it.
Source, checked 25 October 2026
BM25 weighs rarity, repeats and length
Robertson and Zaragoza (2009) call BM25 one of the most successful text-retrieval algorithms to come out of the probabilistic relevance framework.
Source, checked 25 October 2026
Cleaning helps; other words still miss
BEIR (Thakur et al., 2021) tested ten retrieval systems on 18 public datasets and found BM25 a robust baseline on data the systems were not trained for.
Source, checked 25 October 2026
Precision and recall over labelled searches
scikit-learn’s guide: precision is the share of what was picked that is right; recall is the share of the right ones that were found.
Source, checked 25 October 2026
The story
Before Larkspur Supply Co.’s AI assistant, staff found answers with a search box over the company’s documents; the team builds its index, tunes its scoring and finds where words stop working. You’re on the team that runs the search box.
Your path


Chapter 2 · done
How does an index answer a search without reading the pages?





Anyone whose product has a search box, or who wants to know what AI search adds to it. The scoring formulas stay folded away; RAG picks up where this module ends.