lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack Krupansky" <>
Subject Re: OR query with null value and non-null value(s)
Date Fri, 07 Jun 2013 14:04:55 GMT
Yes, it SHOULD! And in the LucidWorks Search query parser it does. Why 
doesn't it in Solr? Ask Yonik to explain that!

-- Jack Krupansky

-----Original Message----- 
From: Rahul R
Sent: Friday, June 07, 2013 1:21 AM
Subject: Re: OR query with null value and non-null value(s)

Thank you Shawn. This does work..... To help me understand better, why do
we need the *:* ? Shouldn't it be implicit ?
fq=(price:4+OR+(-price:[* TO *]))  //does not work
mean the same as
fq=(price:4+OR+(*:* -price:[* TO *]))   //works

Why does Solr need the *:* there ?

On Fri, Jun 7, 2013 at 12:07 AM, Shawn Heisey <> wrote:

> On 6/6/2013 12:28 PM, Rahul R wrote:
>> I have recently enabled facet.missing=true in solrconfig.xml which gives
>> null facet values also. As I understand it, the syntax to do a faceted
>> search on a null value is something like this:
>> &fq=-price:[* TO *]
>> So when I want to search on a particular value (for example : 4)  OR null
>> value, I would expect the syntax to be something like this:
>> &fq=(price:4+OR+(-price:[* TO *]))
>> But this does not work. After searching around for more, read somewhere
>> that the right way to achieve this would be:
>> fq=-(-price:4+AND+price:[*+TO+***])
>> Now this does work but seems like a very roundabout way. Is there a 
>> better
>> way to achieve this ?
> Pure negative queries don't work -- you have to have results in the query
> before you can subtract.  For some top-level queries, Solr is able to
> detect this situation and fix it internally, but on inner queries you must
> explicitly state your intentions.  It is best if you always use '*:*
> -query' syntax, just to be safe.
> fq=(price:4+OR+(*:* -price:[* TO *]))
> Thanks,
> Shawn

View raw message