Search is a lookup, not a scan
The naive way to find documents containing "tomato" is to read every document and check. At a million documents that is a million reads per query, and search engines answer in milliseconds, so that is not what happens.
What happens is the same trick as the index at the back of a book: precompute, for every term, the list of documents containing it. At query time, finding "tomato" is one lookup that returns a ready-made list.
Definition: an inverted index maps each term to its postings list: the ids of the documents containing that term, usually with extra per-document detail such as how often the term occurs and at which positions.
The word inverted is the point. A document is naturally a mapping from one id to many words. Search needs the inverse: from one word to many ids. Building and maintaining that inversion, compactly and updatably, is what Lucene and every engine built on it, Elasticsearch, OpenSearch, Solr, spend most of their engineering on.
Everything else in search, scoring, phrase matching, filtering, is machinery layered on top of postings lists. Get comfortable with the lists and the rest of the course has somewhere to stand.

