The Inverted Index — The Data Structure That Makes Search Possible
One data structure is responsible for the fact that you can search billions of documents in milliseconds: the inverted index. It's a beautifully simple idea — instead of asking "what words are in this document?", precompute "what documents contain this word?" — and it's the engine inside every search engine from Google to Elasticsearch. This post builds the inverted index from scratch and shows why it, and not raw scanning, is how search actually works.
One structure lets you search billions of documents in milliseconds: the inverted index. Instead of 'what words are in this document?', precompute 'what documents contain this word?'. Postings lists, intersecting them for queries, and why it scales to the web — and underlies the keyword half of hybrid RAG.