Solr/Lucene does not implement strict boolean logic. Here's an
excellent blog discussing this:

http://searchhub.org/dev/2011/12/28/why-not-and-or-and-not/

Best
Erick

On Tue, Jan 22, 2013 at 7:25 PM, Otis Gospodnetic
<otis.gospodne...@gmail.com> wrote:
> Well, depends on what you indexed.
>
> Otis
> Solr & ElasticSearch Support
> http://sematext.com/
> On Jan 22, 2013 5:48 PM, "Anders Melchiorsen" <m...@spoon.kalibalik.dk>
> wrote:
>
>> Thanks, though I am still confused.
>>
>> How about this one:
>>
>> manu:apple => 1 hit
>> +name:video => 2 hits
>>
>> manu:apple +name:video => 2 hits
>>
>> Solr ignores the manu:apple part completely?
>>
>>
>> Cheers,
>> Anders.
>>
>>
>> Den 22/01/13 23.16, Jack Krupansky skrev:
>>
>>> 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.
>>>
>>
>>

Reply via email to