Thank you Shawn. This does work..... To help me understand better, why do
we need the *:* ? Shouldn't it be implicit ?
Shouldn't
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 <s...@elyograg.org> 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
>
>

Reply via email to