The Boolean Retrieval Model

Retrieval as exact logical matching. Documents as sets of terms, queries as expressions in AND, OR, and NOT, evaluation with the incidence matrix worked row by row, queries as regions of a Venn diagram, bit vectors as filters, normal forms and their blow-up, and why the model's precision and predictability come with the problem of too many or too few results. Worked problems on an incidence matrix, on the result sets a query can return, and on a conversion to disjunctive normal form.

The Boolean retrieval model treats a document as the set of its terms and retrieves it exactly when it satisfies a query in AND, OR and NOT: intersection, union and complement of postings, giving an unranked set. On six Shakespeare plays, Brutus AND Caesar AND NOT Calpurnia returns Antony and Cleopatra and Hamlet. A query on $n$ terms can only select some of the $2^n$ regions of a Venn diagram, so exactly $2^{2^n}$ logically different queries exist, 256 for three terms. Converting a CNF query of $n$ two-term clauses to DNF, or the reverse, needs at least $2^n$ clauses. The model gives control, reproducibility and explainability, at the cost of feast-or-famine result sizes, no degrees of match, and satisfaction in place of relevance.

The inverted index answered the thesis student's seabird AND warm with document 2. Manning, Raghavan, and Schütze (2008, §1.1) open their textbook with a question of the same kind: which of Shakespeare's plays contain Brutus and Caesar but not Calpurnia? Written as a query, it is

Brutus AND Caesar AND NOT Calpurnia

The answer is a set of plays, Antony and Cleopatra and Hamlet, every one of which satisfies the condition exactly. There is no "best" match and no ranking. A play that mentions Calpurnia once in passing is excluded as firmly as one about her. What exactly does such a query ask for, and why did a model this strict serve the largest search services for three decades? It asks for the set of documents whose terms make a logical expression true. The strictness is what the searcher is buying: the result is exactly what was asked for, it can be explained document by document, and the same query returns it again tomorrow.

This is the Boolean retrieval model, the first model in the course. It was the main or only option that large commercial search services offered until the early 1990s (Manning, Raghavan, and Schütze, 2008, §1.4). The rest of this topic computes its set operations quickly.

First we define the model and evaluate three queries by hand on six plays. Next we see every query as a choice of regions in a Venn diagram, and as one of two standard shapes. Then we weigh the model's strengths against its weaknesses. Worked problems close the article.

The model

The model has three parts.

Documents are sets of terms. A document is represented only by which index terms it contains. How often a term occurs, where it occurs, and how long the document is are all ignored.

Queries are Boolean expressions. Terms are combined with three operators:

  • A AND B matches documents that contain both $A$ and $B$;
  • A OR B matches documents that contain $A$, $B$, or both;
  • NOT A matches documents that do not contain $A$.

Parentheses group subexpressions, as in (Brutus OR Cassius) AND Caesar.

Retrieval is satisfaction. Replace each term by true or false, according to whether the document contains it. The document is retrieved if and only if the query expression is then true.

Each term corresponds to the set of documents containing it, its postings. So the operators correspond exactly to set operations. Write $D$ for the whole collection and $P(t)$ for the set of documents that contain term $t$. Then

$$P(A \text{ AND } B) = P(A) \cap P(B), \qquad P(A \text{ OR } B) = P(A) \cup P(B), \qquad P(\text{NOT } A) = D \setminus P(A).$$

The result of any query is therefore a set built from the postings of its terms by intersection, union, and difference. The algorithms that compute those operations efficiently are the subject of intersecting postings lists.

The representation is the important simplification. Once a play is reduced to the set of words it contains, two plays with the same vocabulary are indistinguishable. A word used once counts the same as a word used a hundred times. Every strength and weakness discussed below follows from that choice.

Evaluating a query with the incidence matrix

How is a query evaluated in practice? On a small collection, by bitwise operations on the rows of a matrix. The term-document incidence matrix makes the correspondence concrete. It has a row for each term and a column for each document, with a 1 where the document contains the term. Each term's row is a bit vector with one bit per document. Each document's column is the set of terms it contains. The inverted index article shows the full matrix for seven terms and six plays, from Manning, Raghavan, and Schütze (2008, Figure 1.1). Read down the columns, it gives each play as a set:

Play Terms it contains (of the seven)
Antony and Cleopatra Antony, Brutus, Caesar, Cleopatra, mercy, worser
Julius Caesar Antony, Brutus, Caesar, Calpurnia
The Tempest mercy, worser
Hamlet Brutus, Caesar, mercy, worser
Othello Caesar, mercy, worser
Macbeth Antony, Caesar, mercy

To evaluate a query, read the rows instead. Order the plays Antony and Cleopatra, Julius Caesar, The Tempest, Hamlet, Othello, Macbeth. The rows for the opening query are then

Term Bit vector
Brutus 110100
Caesar 110111
Calpurnia 010000

NOT complements a vector, and AND and OR become bitwise operations, computed one position at a time:

Brutus              110100
Caesar              110111
NOT Calpurnia       101111
AND of all three    100100

The 1s in positions 1 and 4 give the answer: Antony and Cleopatra and Hamlet. Julius Caesar contains all three names and is excluded by the NOT.

Hamlet may be a surprise, and it shows how a Boolean system reads a query. The play is retrieved because Polonius mentions having once played Julius Caesar and been killed by Brutus (the lines are in the text's Figure 1.2), not because it concerns either man. The system reports which documents satisfy the expression, not which are about the subject.

Two more queries, step by step

What happens when one operator changes? The result can change a great deal. Replacing the first AND of the opening query with OR gives the course text's own example of a more complex query (Manning, Raghavan, and Schütze, 2008, §1.3), and it widens the result:

(Brutus OR Caesar) AND NOT Calpurnia

Brutus                      110100
Caesar                      110111
Brutus OR Caesar            110111
NOT Calpurnia               101111
result                      100111

Four plays now qualify: Antony and Cleopatra, Hamlet, Othello, and Macbeth. Othello and Macbeth mention Caesar but not Brutus, so the OR admits them. One change of operator doubled the result. It is a small instance of the "feast or famine" behavior described below.

A NOT can also apply to a whole subexpression. Suppose we want the plays that mention Antony or Caesar but keep clear of the conspiracy, mentioning neither Brutus nor Calpurnia. The query is evaluated from the inside out:

(Antony OR Caesar) AND NOT (Brutus OR Calpurnia)

Antony                      110001
Caesar                      110111
Antony OR Caesar            110111
Brutus OR Calpurnia         110100
NOT (Brutus OR Calpurnia)   001011
result                      000011

The answer is Othello and Macbeth. Notice that Antony OR Caesar equals the Caesar row: every play here that names Antony also names Caesar.

Each line is a single machine operation on a word of bits, which is why bitmap evaluation is fast. A 64-bit processor combines 64 documents per instruction. All numbers in this section are computed by tools/experiments/boolean/boolean_model.py.

Example (every AND changed to OR). Brutus OR Caesar OR Calpurnia matches five of the six plays, where Brutus AND Caesar AND Calpurnia matches one. The AND of the three rows is 010000, which is Julius Caesar alone. The OR of the three rows is 110111, every play except The Tempest, which names none of the three. Changing each AND to OR took the result from one play to five.

Bitwise evaluation is fast, but as the inverted index article explains, the matrix is far too large and sparse to store for a real collection. Practical systems evaluate the same set operations on sorted postings lists instead.

Where bit vectors are still used

The matrix as a whole does not scale, but a single row of it often does. The cost of a row is fixed at one bit per document, however many documents contain the term. A sorted list of docIDs costs a whole number per posting. For a collection of 1,000,000 documents a row takes $1{,}000{,}000 / 8 = 125{,}000$ bytes. A term found in 50,000 documents takes $50{,}000 \times 4 = 200{,}000$ bytes as a list of uncompressed 32-bit docIDs, and a term found in 500 takes 2,000. The row is the smaller form whenever the term occurs in more than one document in 32, here 31,250 documents. (Compressed lists move the break-even point without removing it.)

The terms that pass that threshold are the common ones, and the commonest conditions in a search are not words at all. They are filters: a language, a date range, a document type, "in stock". A filter matches a large share of the collection, the same filter accompanies many different queries, and it only selects documents without affecting their order. A bit vector suits all three properties. It is small for a dense set, it can be computed once and kept, and applying it to any result is one more AND. The same filters accompany nearest-neighbor search over embeddings, where they are harder to apply: Vector Search on Disk and with Filters measures when filtering before, after or during a graph search fails.

Example (a row as a filter). Suppose every search of the six plays is restricted to plays that contain worser, whose row is 101110. Each of the three worked results takes one more bitwise AND:

Brutus AND Caesar AND NOT Calpurnia                100100   AND 101110  =  100100
(Brutus OR Caesar) AND NOT Calpurnia               100111   AND 101110  =  100110
(Antony OR Caesar) AND NOT (Brutus OR Calpurnia)   000011   AND 101110  =  000010

The first result is unchanged. The second loses Macbeth and the third keeps only Othello, because Macbeth does not contain worser. The filter row was read three times and computed once.

Two published designs build on this. Culpepper and Moffat (2010) store the longest postings lists of an index as bit vectors and the rest as compressed lists, and intersect the two kinds together. Roaring bitmaps (Chambi, Lemire, Kaser, and Godin, 2016) make the choice separately for each block of $2^{16} = 65{,}536$ consecutive docIDs. A block holding at most 4,096 docIDs is stored as a sorted array of 16-bit numbers, and a fuller block as a bitmap of 65,536 bits. The threshold is the break-even point again: $4{,}096 \times 16 = 65{,}536$ bits, the size of the bitmap.

Queries as regions of a Venn diagram

Is there a way to see every possible query on three terms at once? There is, in a Venn diagram. Three terms divide the collection into eight regions, one for each combination of contains and does not contain. Each play falls into exactly one region, determined by its column of the matrix.

The three circles are the plays containing Brutus, Caesar, and Calpurnia. The shaded region, inside Brutus and Caesar but outside Calpurnia, holds the answer to Brutus AND Caesar AND NOT Calpurnia: Antony and Cleopatra and Hamlet. Notice that Julius Caesar sits in the center, inside all three, that The Tempest lies outside every circle, and that four regions are empty for these six plays.
The three circles are the plays containing Brutus, Caesar, and Calpurnia. The shaded region, inside Brutus and Caesar but outside Calpurnia, holds the answer to Brutus AND Caesar AND NOT Calpurnia: Antony and Cleopatra and Hamlet. Notice that Julius Caesar sits in the center, inside all three, that The Tempest lies outside every circle, and that four regions are empty for these six plays.
Brutus Caesar Calpurnia Plays in the region Satisfies the query?
yes yes yes Julius Caesar no
yes yes no Antony and Cleopatra, Hamlet yes
yes no yes none no
yes no no none no
no yes yes none no
no yes no Othello, Macbeth no
no no yes none no
no no no The Tempest no

The table is a truth table for the query, with the documents sorted into its rows. It makes two facts visible.

First, a Boolean query over three terms can do no more than choose a subset of these eight regions, and every document in a chosen region is retrieved. The reason is that the query's truth value for a document depends only on which of the three terms the document contains, and two documents in the same region contain the same ones. There are $2^{8} = 256$ subsets of the eight regions. Every one of them is selected by some query: write each chosen region as an AND clause, such as Brutus AND Caesar AND NOT Calpurnia, and join the clauses with OR. (The empty subset is selected by Brutus AND NOT Brutus.) So exactly 256 logically different queries can be written with three terms, however the operators are arranged.

The same count holds for any number of terms. With $n$ terms there are $2^{n}$ regions, one for each combination of contains and does not contain, and so $2^{2^{n}}$ logically different queries: 16 for two terms, 256 for three, 65,536 for four. A dense retriever faces the same kind of question with geometry in place of logic: Limits of Single-Vector Retrieval bounds how many sets of top results a fixed dimension can return.

Second, the shape of the query does not matter, only which regions it selects. (Brutus OR Caesar) AND NOT Calpurnia selects the three regions with Brutus or Caesar but no Calpurnia. The bitwise computation above is just a fast way of finding the documents in them.

Example (two plays no query can separate). No query on Brutus, Caesar, and Calpurnia retrieves Othello without Macbeth. Both plays sit in the same region, and every query on these terms takes or leaves the whole region. Separating them needs another term, such as worser, which Othello contains and Macbeth does not.

Normal forms

The regions also suggest a standard way to write any query. Any Boolean expression can be rewritten in two standard shapes. A conjunctive normal form (CNF) query is an AND of OR clauses:

(car OR automobile OR vehicle) AND (insurance OR coverage) AND NOT motorcycle

A disjunctive normal form (DNF) query is an OR of AND clauses. The Venn diagram gives DNF a direct meaning. Each fully specified region, such as Brutus AND Caesar AND NOT Calpurnia, is an AND clause, and any query is the OR of the regions it selects.

CNF is the natural form for how expert searchers write queries. Each OR clause gathers the synonyms and variants for one concept of the information need, and the ANDs require every concept to be present. It is also convenient for evaluation. Each clause can be computed once and the clauses intersected in an efficient order, as described in optimizing Boolean queries.

Converting between the forms uses the distributive law, $X \wedge (Y \vee Z) = (X \wedge Y) \vee (X \wedge Z)$, and De Morgan's law. Take the conspiracy query above. De Morgan's law first turns NOT (Brutus OR Calpurnia) into NOT Brutus AND NOT Calpurnia. Distributing the remaining AND over the OR then gives

(Antony AND NOT Brutus AND NOT Calpurnia) OR (Caesar AND NOT Brutus AND NOT Calpurnia)

Antony AND NOT Brutus AND NOT Calpurnia    000001
Caesar AND NOT Brutus AND NOT Calpurnia    000011
OR of the two                              000011

It gives the same answer, Othello and Macbeth. But the DNF repeats both negations and has more operations to perform.

How much longer can the conversion make a query? Far longer. A CNF query of $n$ two-term clauses, $(a_1 \text{ OR } b_1) \text{ AND } \dots \text{ AND } (a_n \text{ OR } b_n)$, has $2n$ term occurrences. Distributing it into DNF produces one AND clause for every way of picking $a_i$ or $b_i$ from each clause. That is $2^n$ clauses of $n$ terms each:

$n$ Terms in CNF Clauses in DNF Terms in DNF
1 2 2 2
2 4 4 8
3 6 8 24
4 8 16 64
5 10 32 160
6 12 64 384

A professional search with six concepts, each with a pair of synonyms, would become 64 conjunctions.

A cleverer conversion cannot do better, because no DNF of this query is shorter. Here is the idea in one sentence: each way of picking one term per clause is a smallest set of terms that satisfies the query, and every such set needs an AND clause of its own.

The formal version. Let $T$ be a set of terms made by picking exactly one of $a_i$, $b_i$ for each $i$. A document containing exactly the terms of $T$ satisfies the CNF query. A document containing only some of them does not, since the clause of a missing term is then false. Now take any DNF equivalent to the query. The document containing exactly $T$ satisfies it, so it satisfies one of its AND clauses, say $C$. Let $P$ be the set of terms that $C$ requires, and note that every term $C$ excludes with NOT lies outside $T$. Then $P \subseteq T$. A document containing exactly the terms of $P$ also satisfies $C$: it has the required terms, and it has none of the excluded ones, which are outside $T$ and so outside $P$. It therefore satisfies the query, which forces $P = T$. So the DNF has a clause that requires exactly the terms of $T$. Different choices of $T$ give different clauses, and there are $2^n$ choices, so every equivalent DNF has at least $2^n$ clauses with at least $n$ terms each. $\blacksquare$

The other direction grows in the same way. A DNF query of $n$ two-term clauses, $(a_1 \text{ AND } b_1) \text{ OR } \dots \text{ OR } (a_n \text{ AND } b_n)$, is converted to CNF with the other distributive law, $X \vee (Y \wedge Z) = (X \vee Y) \wedge (X \vee Z)$. The result has one OR clause for every way of picking $a_i$ or $b_i$ from each AND clause, again $2^n$ clauses of $n$ terms. No CNF is shorter. Suppose some CNF of this query had $m$ clauses. Negating it with De Morgan's law gives a DNF of $m$ clauses for the negated query, and the negated query is $(\text{NOT } a_1 \text{ OR NOT } b_1) \text{ AND } \dots \text{ AND } (\text{NOT } a_n \text{ OR NOT } b_n)$. Replacing every term by its negation throughout turns that DNF into a DNF, still of $m$ clauses, for the CNF query of the table. So $m \ge 2^n$ by the result just proved. The script checks the count of smallest satisfying sets and the De Morgan identity for $n$ up to 4.

Converting an arbitrary expression to either normal form can therefore make it exponentially longer. Systems usually evaluate the expression as written, as a tree (see parsing and evaluating Boolean queries).

Strengths

We now have the whole model. It persisted in commercial systems for decades, and remains the default for many professional searchers, for five reasons.

  • Control. The searcher states exactly which documents qualify. Nothing is retrieved for reasons the searcher cannot see.
  • Predictability and reproducibility. The same query on the same collection always returns the same set. A systematic review can report its search and others can rerun it, as described in search in professional domains.
  • Explainability. Every retrieved document can be justified by pointing at the terms that satisfied the query.
  • Efficiency. Set operations on sorted lists are fast. They need only document identifiers in the index, not frequencies or positions.
  • Natural fit for structured conditions. Restrictions such as a date range, a document type, or a jurisdiction are exact conditions. Search engines apply them as Boolean filters, even when they rank the text matches.

Weaknesses

The same exactness creates the model's characteristic problems (Manning, Raghavan, and Schütze, 2008, §1.4).

Feast or famine. Boolean queries tend to return either too many results or too few. A query of a few terms joined by AND may match nothing, and relaxing one AND to an OR may match thousands. With no ranking, a large result set must be read in arbitrary order. The searcher's only remedy is to add terms until the set is small enough. Finding a query that returns a manageable number of relevant documents takes skill and repeated attempts.

No degrees of match. A document that satisfies four of five ANDed conditions is excluded as completely as one that satisfies none. A document that contains a query term once is treated the same as one that contains it fifty times. In the Venn diagram, every region is either fully in or fully out.

All terms count equally. There is no way to say that one concept matters more than another, except by making it mandatory.

NOT removes relevant documents. A document that mentions an excluded term once, in passing, is lost, even if it is otherwise the best match.

Satisfaction is not relevance. As the Hamlet example shows, a document can satisfy a query without being about its subject. A relevant document that uses different words fails it. The Boolean model does nothing about the vocabulary mismatch problem beyond what the searcher builds into OR clauses. Dense passage retrieval attacks the mismatch from the other side, by comparing learned vectors of the query and passage instead of their terms.

William Cooper (1988) argued that such problems belong to the Boolean design itself rather than to particular systems, and sketched alternative designs that avoid them. The mismatch is a basic one. Relevance comes in degrees and depends on many weak pieces of evidence, while Boolean logic deals only in strict yes-or-no conditions. Blair and Maron's study of a legal Boolean system, described in search in professional domains, showed the practical consequence. Expert searchers believed they had found most relevant documents while actually finding about a fifth of them.

Common misreadings

A few points trip up newcomers to Boolean queries.

  • AND narrows, OR widens. In everyday speech, "plays about Brutus and Caesar" can mean plays about either. In a query, AND requires both and shrinks the result, while OR accepts either and grows it. The first two example queries differ by one operator and by a factor of two in result size.
  • NOT is relative to the whole collection. NOT Calpurnia alone matches every play without Calpurnia: five of the six here, including The Tempest, which mentions none of the other names. A NOT is useful as a filter on something already selected. That is why systems evaluate X AND NOT Y as a difference rather than computing the complement (see intersecting postings lists).
  • Precedence is a convention. In most systems, Brutus OR Caesar AND Calpurnia means Brutus OR (Caesar AND Calpurnia), because AND binds more tightly than OR. Not all systems agree, and parentheses remove the doubt. Parsing and evaluating Boolean queries shows how a parser settles it.

The Boolean model inside ranked systems

The model did not disappear when ranked retrieval replaced it as the default. It survives in three roles:

  1. Candidate selection. Ranked systems first gather candidate documents from the postings of the query terms, then score only those candidates. Web search engines have traditionally required all the terms, an implicit AND. Many other engines accept documents containing any of them, an OR, and rely on ranking to order them. Either way, the operations of this topic produce the candidate set.
  2. Filters and facets. Structured restrictions are applied exactly, as Boolean conditions on fields, often held as the bit vectors described above.
  3. Explicit operators. Quotation marks, minus signs, and advanced-search forms on web search engines are Boolean and phrase operators, offered to users who want control.

Boolean search in practice describes these uses. The vector space model takes up the alternative: a graded score that ranks every document by how well it matches.

Worked problems

Problems 1 and 2 are Exercises 1.2 and 1.3 of the course text (Manning, Raghavan, and Schütze, 2008), restated in our own words. Problem 3 is posed here on the six plays, and Problem 4 evaluates the query of the text's Exercise 1.5 on them, and carries out its Exercise 1.6 (rewriting that query in disjunctive normal form and comparing the cost) on the same plays. The script checks every answer.

Problem 1. A collection has four documents:

docID Text
1 breakthrough drug for schizophrenia
2 new schizophrenia drug
3 new approach for treatment of schizophrenia
4 new hopes for schizophrenia patients

Give its term-document incidence matrix and its inverted index.

Solution. The four texts contain ten distinct words. No stop list or stemming is asked for, so each word is a term. The matrix has a row for each term, in alphabetical order, and a column for each document. Each entry is 1 if the document contains the term:

Term Doc 1 Doc 2 Doc 3 Doc 4
approach 0 0 1 0
breakthrough 1 0 0 0
drug 1 1 0 0
for 1 0 1 1
hopes 0 0 0 1
new 0 1 1 1
of 0 0 1 0
patients 0 0 0 1
schizophrenia 1 1 1 1
treatment 0 0 1 0

The inverted index lists, for each term, the docIDs of the 1s in its row, in increasing order:

approach       3
breakthrough   1
drug           1, 2
for            1, 3, 4
hopes          4
new            2, 3, 4
of             3
patients       4
schizophrenia  1, 2, 3, 4
treatment      3

The matrix has $10 \times 4 = 40$ entries, 18 of them 1s, and the index stores exactly those 18 as postings.

Problem 2. For the collection of Problem 1, find the documents returned by (a) schizophrenia AND drug and (b) for AND NOT (drug OR approach).

Solution. (a) The rows are 1111 for schizophrenia and 1100 for drug. Their bitwise AND is 1100, so the query returns documents 1 and 2. In postings, $\{1, 2, 3, 4\} \cap \{1, 2\} = \{1, 2\}$.

(b) Work from the inside out. drug OR approach is 1100 OR 0010, which is 1110. Its complement is 0001. The row of for is 1011, and 1011 AND 0001 is 0001. The query returns document 4 alone. In postings, $\{1, 3, 4\} \setminus (\{1, 2\} \cup \{3\}) = \{4\}$. Documents 1 and 3 contain for and are removed by the NOT, the first for drug and the second for approach.

Problem 3. The six plays have $2^6 = 64$ subsets. How many of them can be the result of a query that uses only the terms Brutus, Caesar, and Calpurnia? How many of the 256 logically different queries return each of those results?

Solution. Sixteen subsets, each returned by sixteen queries. A query selects a set of the eight regions, and its result is the set of plays in the selected regions. Only four regions hold any plays, by the table of regions above:

  • Julius Caesar (all three terms);
  • Antony and Cleopatra and Hamlet (Brutus and Caesar only);
  • Othello and Macbeth (Caesar only);
  • The Tempest (none of the three).

A result is therefore a union of some of these four groups, and there are $2^4 = 16$ such unions. The other $64 - 16 = 48$ subsets cannot be retrieved by any query on these terms: each of them splits one of the two-play groups. Two queries return the same result exactly when they select the same occupied regions and differ only on the four empty ones, so each result comes from $2^4 = 16$ of the 256 queries, and $16 \times 16 = 256$. The script confirms the count of 16 by running through all 256 subsets of regions.

Problem 4. Evaluate (Brutus OR Caesar) AND NOT (Antony OR Cleopatra) on the six plays, then rewrite it in disjunctive normal form and evaluate that.

Solution. The result is Hamlet and Othello. The rows needed are Antony 110001, Brutus 110100, Caesar 110111 and Cleopatra 100000, with the plays in the order used throughout.

Brutus OR Caesar              110111
Antony OR Cleopatra           110001
NOT (Antony OR Cleopatra)     001110
result                        000110

The 1s are in positions 4 and 5, Hamlet and Othello.

For the DNF, De Morgan's law turns NOT (Antony OR Cleopatra) into NOT Antony AND NOT Cleopatra. The distributive law then spreads the AND over Brutus OR Caesar:

(Brutus AND NOT Antony AND NOT Cleopatra) OR (Caesar AND NOT Antony AND NOT Cleopatra)

Brutus AND NOT Antony AND NOT Cleopatra    000100
Caesar AND NOT Antony AND NOT Cleopatra    000110
OR of the two                              000110

The result is the same, as it must be. The original form needs two ORs, one NOT and one AND, four operations. The DNF uses each negation in both clauses. Written out as two separate clauses, even with each complement computed once and reused, it takes two NOTs, four ANDs and one OR, seven operations. Sharing the common part NOT Antony AND NOT Cleopatra brings it to six, still more than four, for the same answer. On this query the DNF is the more expensive form.

What we have learned

A Boolean query asks for the set of documents that satisfy a logical expression, computed by intersection, union, and difference of postings. The Venn diagram showed what no query can do: separate two documents in the same region. A single row of the matrix survives as the bit vector behind a filter. The model's control and reproducibility come from the same exactness that causes feast or famine.

The matrix served six plays, but a real collection needs postings lists. The next article, Intersecting Postings Lists, shows how two sorted lists are intersected in one pass, without comparing every pair of entries.

References

  • Blair, D. C., and Maron, M. E. (1985). An evaluation of retrieval effectiveness for a full-text document-retrieval system. Communications of the ACM, 28(3), 289–299. record · 3 pages
  • Chambi, S., Lemire, D., Kaser, O., and Godin, R. (2016). Better bitmap performance with Roaring bitmaps. Software: Practice and Experience, 46(5), 709–719. record
  • Cooper, W. S. (1988). Getting beyond Boole. Information Processing and Management, 24(3), 243–248. record
  • Culpepper, J. S., and Moffat, A. (2010). Efficient set intersection for inverted indexing. ACM Transactions on Information Systems, 29(1), article 1. record · 3 pages
  • Manning, C. D., Raghavan, P., and Schütze, H. (2008). Introduction to Information Retrieval, sections 1.1, 1.3, and 1.4. Cambridge University Press. record · 102 pages

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