You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Carlos Bonilla <ca...@gmail.com> on 2013/11/26 16:26:39 UTC

Query with negative range clause

Hi,
I'm running a query that looks like:

*fieldA:"blabla" OR NOT fieldB:[100 to *]*

but in this way I get wrong results. However If I convert it into

*NOT(NOT fieldA:"blabla" AND fieldB:[100 to *])*

I get the expected (and correct) results.

I also found there is a post about this:
http://stackoverflow.com/questions/634765/using-or-and-not-in-solr-query

Could anyone explain to me why this happens?

Thanks.

Re: Query with negative range clause

Posted by Erick Erickson <er...@gmail.com>.
First, this is better asked on the Solr user's list, see:

http://lucene.apache.org/solr/discussion.html

Second, you haven't given us anything to go on. What
do you expect? What are your inputs? What are your
actual outputs? Did you attach &debug=query to
the URL and examine the parsed query? You might
review:

http://wiki.apache.org/solr/UsingMailingLists

Third, the query language is not strictly boolean logic,
see:
http://searchhub.org/dev/2011/12/28/why-not-and-or-and-not/

Best,
Erick


On Tue, Nov 26, 2013 at 10:26 AM, Carlos Bonilla
<ca...@gmail.com>wrote:

> Hi,
> I'm running a query that looks like:
>
> *fieldA:"blabla" OR NOT fieldB:[100 to *]*
>
> but in this way I get wrong results. However If I convert it into
>
> *NOT(NOT fieldA:"blabla" AND fieldB:[100 to *])*
>
> I get the expected (and correct) results.
>
> I also found there is a post about this:
> http://stackoverflow.com/questions/634765/using-or-and-not-in-solr-query
>
> Could anyone explain to me why this happens?
>
> Thanks.
>
>