lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Elschot <>
Subject Re: how Boolean query work internally in lucene
Date Sat, 01 Jul 2006 08:51:52 GMT
On Saturday 01 July 2006 09:37, Amit wrote:
> Hi All,
> I just want to know how the lucene processes the Boolean query internally??
> As per my knowledge:
>    if I search for "java apache".

This is a PhraseQuery internally in Lucene.

>    Note: let consider i want documents that contents both words and i
> constructed boolean query for that (i.e. +java +apache).
>    Please let me clear if i wrong how lucene process this query?
>    First it search for all document for java then for apache and after that
> it take the intersection of these to sets. is it?
>    if so where i want to know where lucene take the intersection and how
> process the query??

It's a mix of determining the documents per term and merging.
It works in the order of the internal document number, (which is the order
of addition to the index, ) for both sets of documents.
To determine the next matching document each set of documents
advances to the document number at or after the current document of the
other set, until both sets have the same document number.

The intersection is taken in ConjunctionScorer and the sets are
represented by a TermScorer, both viewable in this package:
Advancing to a document number at or after a given document number
is done in the skipTo() methods.

Paul Elschot

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

View raw message