lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack Krupansky" <j...@basetechnology.com>
Subject Re: Confused by queries
Date Tue, 22 Jan 2013 22:16:33 GMT
The first query:

    name:ipod OR -name:ipod => 0 hits

The "OR" and "-" are actually at the same level of the BooleanQuery, so the 
"-" overrides the OR so it's equivalent to:

    name:ipod -name:ipod => 0 hits

For the second query:

    (name:ipod) OR (-name:ipod) => 3 hits

Pure negative queries are supported only at the top level, so the 
"(-name:ipod)" matches nothing, so the query is equivalent to:

    (name:ipod) => 3 hits

You can simply insert a "*:*" to assure that it is not a pure negative query 
inside the parentheses:

    (name:ipod) OR (*:* -name:ipod)

-- Jack Krupansky

-----Original Message----- 
From: Anders Melchiorsen
Sent: Tuesday, January 22, 2013 4:59 PM
To: solr-user@lucene.apache.org
Subject: Confused by queries

Hello!

With the example server of Solr 4.0.0 (with *.xml indexed), I get these
results:

*:* => 32 hits
name:ipod => 3 hits
-name:ipod => 29 hits

That is all fine, but for these next queries, I would expect to get 32
hits (i.e. everything), or at least the same number of hits for both
queries:

name:ipod OR -name:ipod => 0 hits
(name:ipod) OR (-name:ipod) => 3 hits

As my expectations are not met, I must be missing something?


Thanks,
Anders. 


Mime
View raw message