liveBook · Manning

Indexing

As explained in Natural Language Processing in Action, Second Edition

Indexing is the construction of auxiliary structures that organize document content for efficient retrieval.

Indexing organizes document content so searches can find matching documents without reading them one by one. It also supports grounding LLM prompts in human-authored information retrieved from trusted sources. section 10.3.1

An inverted index is built in two steps:

  • Create a forward index by listing the words in each document. section 10.3.1
  • Invert that structure into a list of words, each linked to the documents where it appears. section 10.3.1

Finding “cat”

Like checking a textbook index for page numbers, a search can use the inverted index to jump to documents containing “cat,” rather than scan every document. Exact-word indexes can miss “cats”; modern full-text engines use character-based trigram indexes to help find both forms. section 10.3.1

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Defines forward and inverted indexes, contrasts O(1) lookup with O(n) scanning, and notes trigram handling of word variants.
Examples
Uses a textbook index analogy and searches for “cat” and “cats” to illustrate retrieval and exact-match limits.
What you can do after
Apply indexing to retrieve documents matching search terms efficiently, including variants such as “cat” and “cats.”
How it connects
Connects full-text search and inverted indexes with keyword retrieval and large language model grounding.

Also explained in

Compare how 15 books explain indexing →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Natural Language Processing in Action, Second Edition. The section links point to the parts of the book it draws on.