Boolean Retrieval

Exact-match retrieval with AND, OR, and NOT. The Boolean model, intersecting postings lists, skip pointers, query optimization, phrase and proximity queries with positional indexes, parsing query expressions, and where Boolean search is still used.

At the end of Text Processing and Indexing, the four Arctic sentences had an index, and seabird AND warm returned document 2 by intersecting two short lists. A reader may want the plays of Shakespeare that mention Brutus and Caesar but not Calpurnia (they are Antony and Cleopatra and Hamlet), or the court opinions that discuss a host's liability for a drunk guest. Each is a request for the documents that satisfy a logical condition. How does a system answer such requests exactly, and fast, over millions of documents? It combines the sorted postings lists of the query's terms, by intersection, union, and difference.

Boolean retrieval is the model behind that answer. A query is a logical expression of terms joined by AND, OR, and NOT, and a document is retrieved if and only if it satisfies the expression. There are no scores and no ranking, only a set of matching documents. It is the oldest retrieval model still in everyday use, and the simplest. It was the basis of the first large commercial search services. Its precision and predictability keep it in use wherever searchers must control exactly what is retrieved:

  • legal research and patent searching;
  • systematic reviews of the medical literature;
  • the filters on nearly every product search page.

This topic is also where the inverted index is first put to work. Answering a Boolean query is a matter of combining postings lists, and ranked retrieval gathers its candidate documents with the same algorithms. Positional indexes, introduced here for phrase queries, also supply the proximity features that later ranking functions use.

First the topic defines the model and works queries by hand on six of Shakespeare's plays. Then it makes the set operations fast, extends the index with word positions, and turns query strings into trees. Finally it looks at where Boolean search is used today, and at its limit: a Boolean query tends to retrieve either too many documents or too few. The vector space model, the next topic, replaces the yes-or-no decision with a graded score.

Articles

The model

  • The Boolean retrieval model: a document satisfies a query when its set of terms makes the query's logical expression true. Queries as logical expressions and documents as sets of terms, evaluation with the incidence matrix worked row by row, bit vectors as filters, queries as regions of a Venn diagram, normal forms and their exponential blow-up, proved, and the strengths and weaknesses of exact matching.

Processing queries

  • Intersecting postings lists: two sorted lists are combined in one pass by advancing the pointer at the smaller docID. The linear merge for AND, the corresponding merges for OR and AND NOT, their costs, several lists at once, intersection by binary or galloping search when one list is much shorter, measured against the merge, and a lower bound on the comparisons any method needs.
  • Skip pointers: an intersection can jump over entries that cannot match. Shortcuts stored in postings lists, the square-root rule for placing them derived as a cost trade-off and tested by experiment, and skipping in compressed indexes.
  • Optimizing Boolean queries: a query's terms are combined rarest first. Processing terms by increasing document frequency, estimating the size of OR clauses on a real collection, where to apply NOT, rewriting queries with Boolean identities, and every plan for a three-term query measured.
  • Phrase and proximity queries: an index tells warming climate from climate warms by storing the position of every occurrence. Biword indexes and their false positives, positional indexes, the positional merge and window algorithms traced on positions, and phrase, distance, sentence and paragraph queries each worked to the end.
  • Parsing and evaluating Boolean queries: a query string becomes a tree that an index can evaluate. A grammar with operator precedence, a recursive-descent parser traced call by call, query trees, the parser behind this site's search box, and my course assignment, stated and solved.

In practice

  • Boolean search in practice: trained searchers still write Boolean queries where control matters, and ranked engines keep the model as a filter. Professional query languages, the evidence comparing Boolean and ranked search, extended Boolean models that grade matches, and the implicit AND of web search.

Every article ends with worked problems, about half of them exercises from the course text, solved in full.

Course materials

My Boolean query processor for the course is HW02 on GitHub. It parses queries with AND, OR, NOT, and parentheses, evaluates them against an extended version of the HW01 inverted index, and orders the matching documents by TF-IDF.

References

  • Croft, W. B., Metzler, D., and Strohman, T. (2010). Search Engines: Information Retrieval in Practice, section 7.1.1. Addison-Wesley. record · 12 pages
  • Manning, C. D., Raghavan, P., and Schütze, H. (2008). Introduction to Information Retrieval, chapter 1 and sections 2.3–2.4. Cambridge University Press. record · 102 pages

Reviewed: verified, 16 Nov 2026 · citations checked, 16 Nov 2026 · editorial review, 16 Nov 2026 · 7 revisions