lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trejkaz <>
Subject Re: Lucene query behavior using NOT
Date Sun, 08 Feb 2015 10:42:54 GMT
On Sun, Feb 8, 2015 at 9:04 PM, Uwe Schindler <> wrote:
> Hi,
> Lucene does not use algebraic / boolean logic! Maybe review this blog
> post:

This article is an old classic.

The "plus, minus, nothing" operators aren't without their issues
either, though. For example, if you are stuck in an environment where
someone else thought it was a great idea to set the "default operator"
in the query parser to AND, you might wonder what the syntax is for
this third example:

    fish chips
        -> MUST match fish, MUST match chips

    +fish +chips
        -> MUST match fish, MUST match chips

        -> SHOULD match fish, SHOULD match chips

Yeah, I don't know either.

In any case, the issues in the boolean syntax can be avoided:
  * Always use parentheses when mixing different operators (or
possibly use PrecedenceQueryParser. I haven't tried it.)
  * To any boolean query with only NOT clause, transform it to add a
SHOULD clause for MatchAllDocumentsQuery.


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

View raw message