lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Elschot <>
Subject Re: Does order of BooleanQuery clauses affect search performance?
Date Fri, 26 Aug 2005 18:40:44 GMT
On Friday 26 August 2005 17:58, wrote:
> A simple question and I guess it may have been asked before.
> Does the order of Querys in a BooleanQuery affect search speed? By this I
> mean if the first clause of a BooleanQuery only returns a few results and
> the second clause returns lots of results and the two are ANDed is this
> faster than the other way around? Similarly, does searching stop if no

Subqueries of BooleanQuery are called clauses in Lucene.
The order of clauses does not matter.
Having only required clauses does matter, normally a lot.

> results are found and the logical operations would mean no results can be
> found (similar to Javas "short circuiting" of logical operations)?

The development version tries to do as much "short circuiting" as possible.
Lucene 1.4.3 neither short circuits for "or" (optional clauses)
nor for "not" (prohibited clauses).
Both do short circuiting for "and" (required clauses).

Paul Elschot

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message