A phrase query asks for documents containing a specified sequence of indexed terms in the required order. For an exact phrase query, the occurrences occupy consecutive positions. A document containing every requested word can still fail because its words occur in a different order or with intervening terms.[ref]
Introduction to Information Retrieval by Christopher D. Manning and others. §2.4, Positional postings and phrase queries, opening definition and contrast with separate term matches
Let be the set of positions of term in document . For query terms , an exact match exists whenA positional index stores the information needed to test these offsets. Repeated query terms need their own offsets even though their positions come from the same postings list.[ref]
Introduction to Information Retrieval by Christopher D. Manning and others. §2.4.2, Positional indexes, token positions and the repeated-word worked example
Number words from one, without removing any. Document 1 is
red red boat, document 2 is boat red red, and document 3 is blue boat. The exact phrase query red boat matches only document 1, at positions 2–3. Document 2 has exactly the same term frequencies as document 1, but its boat occurs before both red occurrences. Intersecting document identifiers for the two terms would retain it incorrectly.Phrase semantics depend on the indexing pipeline. If some words are removed, preserving their position gaps can prevent a false claim of adjacency. A search allowing intervening words is a different matching condition; quotation marks alone do not specify every implementation's preprocessing choices.
Articles by others on the same topic
There are currently no matching articles.