Cognitive Scaffold

Preparing your thinking workspace

arrow_back_ios_new
MENTAL MODEL · M7590

Inverted Index

Inverted Index
CreateHigh supportDesign Thinking
Included
account_tree

Updated 2026-07-30

Loading revision record…

Summary

An inverted index (also referred to as a reverse index, postings file, or inverted file) is an index data structure that stores a mapping from content, such as words or numbers, to its locations in a document or a set of documents. It is the most common data structure used in document retrieval systems. There are two main variants of inverted indexes: a record-level inverted index (or inverted file index) contains a list of documents for each indexed word, while a word-level inverted index (or fully inverted index) additionally contains the positions of each word within a document. The latter form offers more functionality (such as phrase searches), but requires more time and space to create.

Definition

A mapping from words to lists of documents, rather than from documents to words, enabling extremely fast keyword searches. Scaffolding role: optimize storage structure for queries. Trade write efficiency for read efficiency—design data structures based on usage patterns.

How to use

Optimize storage structure for queries. Trade write efficiency for read efficiency—design data structures based on usage patterns.

Mechanism

Traditional indexes map documents to their contained words; inverted indexes reverse this to map words to lists of document IDs (and positions). Queries only need to look up the word to obtain candidate document sets, avoiding scanning each document. Essentially, it trades space (extra index) for time (query speed) and optimizes the structure according to query patterns (read-heavy, write-light).

Practice

In progress 0/5

Practice this model in one real situation:

Check to track your progress (stored locally)
Learning progress0%

Cases

  • Search engines, Elasticsearch, Lucene; full-text databases; book indexes (word to page numbers); code search tools.

Common pitfalls

  • Assuming that building an index is always beneficial (high cost in write-heavy scenarios); ignoring the match between index and query patterns; index not updated leading to stale results.
Sources

Source support: Explicit

References currently contain only Wikipedia links; primary sources still need review.

  • link
    zh.wikipedia.orghttps://zh.wikipedia.org/wiki/%E5%80%92%E6%8E%92%E7%B4%A2%E5%BC%95ZH · Explicit
    verified
account_treeGenealogyexpand_more

RELATED MODELS