Inverted Index
Updated 2026-07-30
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.
Introduction
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/5Practice this model in one real situation:
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.
- zh.wikipedia.orghttps://zh.wikipedia.org/wiki/%E5%80%92%E6%8E%92%E7%B4%A2%E5%BC%95verified
account_treeGenealogyexpand_more
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS