Yeah, there's a known bug that a negative-only query within parentheses
doesn't match properly - you need to add a non-negative term, such as "*:*".
For example:
text:(+"happy") AND user:(*:* -"123456789")
-- Jack Krupansky
-----Original Message-----
From: Brett Hoerner
Sent: Tuesday, July 1, 2014 2:51 PM
To: solr-user@lucene.apache.org
Subject: Confusion about location of + and - ?
Can anyone explain the difference between these two queries?
text:(+"happy") AND -user:("123456789") = numFound 2912224
But
text:(+"happy") AND user:(-"123456789") = numFound 0
Now, you may just say "then just put - infront of your field, duh!" Well,
text:(+"happy") = numFound 2912224
user:(-"123456789") = numFound 465998192
(FWIW there is no user named 123456789 in my index)
As you can see, the queries work alone, but when combined with an AND I
always get 0 results. If I move the - before the field in my query, it
works. What am I missing here?
Thanks.