You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Jonathan Rochkind <ro...@jhu.edu> on 2011/03/21 16:59:36 UTC

more beware on 1.4.1 lucene QP "NOT"

So Solr 1.4.1, lucene query parser, generally has no problem with a 
query that's simply one clause "NOT""

&defType=lucene
&q=NOT foo

No problem! Also no problem:

&q=foo AND NOT bar

But, problem when the operand to an "OR" is a NOT:

&q=foo OR (NOT bar)

Does NOT work correctly.  Can be worked around if you instead do this:

&q=foo OR (*:* AND NOT bar)



So I think 1.4.1 lucene query parsers handling of "pure negative" 
queries only goes so far, mainly until there's an "OR" involved.

Re: more beware on 1.4.1 lucene QP "NOT"

Posted by Gora Mohanty <go...@mimirtech.com>.
On Mon, Mar 21, 2011 at 9:29 PM, Jonathan Rochkind <ro...@jhu.edu> wrote:
> So Solr 1.4.1, lucene query parser, generally has no problem with a query
> that's simply one clause "NOT""
>
> &defType=lucene
> &q=NOT foo
>
> No problem! Also no problem:
>
> &q=foo AND NOT bar
>
> But, problem when the operand to an "OR" is a NOT:
>
> &q=foo OR (NOT bar)
>
> Does NOT work correctly.  Can be worked around if you instead do this:
>
> &q=foo OR (*:* AND NOT bar)
[...]

Yes, this is definitely a gotcha, but encountering the issue,
and searching Google seems to find the above fix. Just
went through the same thing a couple of weeks ago.

Regards,
Gora