= Positional index
A <positional index> is an <inverted index> whose <postings lists> retain the positions of a term's occurrences within each document. These positions distinguish a <phrase query> from a request for documents merely containing the same words. Positions usually count the terms produced by the indexing pipeline; they need not be character offsets.<Introduction to Information Retrieval by Christopher D. Manning and others>[§2.4.2, Positional indexes, positional postings and phrase matching]{ref}
Number words from one. For document 1, `red boat red sail`, store positions `red: 1,3`, `boat: 2`, `sail: 4`. For document 2, `boat red sail`, store `red: 2`, `boat: 1`, `sail: 3`. The <phrase query> `red boat` asks whether a position $p$ of `red` has a position $p+1$ of `boat` in the same document. Document 1 qualifies at $p=1$; document 2 contains both words but fails. The <phrase query> `red sail` matches both documents.
A <positional index> spends additional storage to preserve ordering information. Removing words during preprocessing without preserving their position gaps can change phrase semantics: the index must specify what counts as adjacent. The same position data can support queries allowing a bounded separation, rather than exact adjacency.
Back to article page