I gave the relevant Solr Jiras on a previous fork of this thread.

Here is the most relevant current Lucene Jira:
https://issues.apache.org/jira/browse/LUCENE-3451
"Remove special handling of pure negative Filters in BooleanFilter, disallow pure negative queries in BooleanQuery"

That patch is still open, with disagreement over whether even giving an exception for this scenario is reasonable. I'll add some comments there. I'm in favor of BooleanQuery implicitly adding the *:* if only negative terms are present.

-- Jack Krupansky

-----Original Message----- From: Shawn Heisey
Sent: Thursday, July 3, 2014 1:01 PM
To: solr-user@lucene.apache.org
Subject: Re: Confusion about location of + and - ?

On 7/1/2014 2:06 PM, Brett Hoerner wrote:
Also, does anyone have the Solr or Lucene bug # for this?

It's not actually a bug.  It's an inherent truth -- you can't subtract
from nothing.  You must tell Lucene what to start with before you can
subtract the 123456789 value.

The fact that a bare query of -field:value works with Solr is because
Solr contains code that recognizes the purely negative query and fills
in an implicit *:* value first.

In cases like this where a purely negative query is just one clause and
not the WHOLE query, Solr is not able to recognize the situation and fix
it.  An enhancement request would be appropriate here, not a bug report.
I do not know if such an enhancement request is already in Jira.

Thanks,
Shawn

Reply via email to