0 day streak

Search, in the system-design sense, is finding the documents that match some words quickly, and the structure behind it is an inverted index: like the index at the back of a book, it maps each word to the list of documents that contain it. Building one means splitting text into terms, normalizing them (lowercasing, perhaps reducing “running” to “run”), and recording where each appears. A query then looks up its words and combines their lists instead of scanning every document. Ranking decides which matches come first; classic scores like TF-IDF and its successor BM25 favor documents where the query words appear often, and give rare words more weight than common ones like “the”. Lucene and Elasticsearch work this way.

In this lesson: Step through building an inverted index from documents.