On 6/6/2013 11:21 PM, Rahul R wrote:
> 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 ?

When you are excluding with the - (NOT) operator, you can't exclude from
nothing, you have to exclude from something.  The *:* tells Solr to
start with everything, then begin excluding whatever matches the
negative query.

You might ask why it works with your earlier example, which is this:

fq=-price:[* TO *]

When Solr encounters a very simple top level query like this, it is able
to detect the problem and fix it, by adding the *:* behind the scenes.
I'm not sure when this negative query detection was added, but before
that version, those queries didn't ever work.  Unfortunately the
detection doesn't work with more complex queries.  It's one of those
things that a person can do easily but is very hard for a computer.

Thanks,
Shawn

Reply via email to