lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael-O <>
Subject Re: Boolean OR does not work as described
Date Tue, 03 Jan 2012 21:26:21 GMT
Hi Uwe,

Uwe Schindler schrieb:
> Hi Mike,
> if you want to mix and/or in one query, always use parenthesis. The
> operator precedence is strange with the default query parser. In
> contrib there is another one (called PrecedenceQueryParser) that can
> handle this but is incompatible with existing queries. The parser in
> contrib on the other hand also has other problems, which are all
> caused by the way how Lucene handles BooleanQuery internally.

I haven't noticed the PrecendenceQP. I never expected the default parser 
being erroneous.

> If you print the parsed query using Query.toString() you can see the
> "normalized" query in standard Lucene syntax. Lucene does not know
> AND/OR, it only knows query clauses that are SHOULD (=optional), MUST
> or MUST_NOT. The query "vorgklasse:au AND schluessel:13????? OR
> schluessel:23?????" will be parsed like:
> MUST: vorgklasse:au MUST: schluessel:13????? SHOULD:
> schluessel:23?????
> Which would be in standard syntax: "+vorgklasse:au
> +schluessel:13????? schluessel:23?????" (first two are MUST clauses,
> third is should). If you read this query using MUST/SHOULD you will
> understand what happens: This means the first 2 terms MUST be in the
> result, the third MIGHT be in the result. So it's not an union, it's
> something more complex :-)

Yes, this is what I have expected as transformed internal query. I 
really differs from what I have expected. I simply performs a first-wins 


schönen Gruß nach Bremen!

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

View raw message