You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Joel Nylund <jn...@yahoo.com> on 2009/12/02 17:26:40 UTC

NOT combined with OR is not getting exected results

http://localhost:8983/solr/select?q=%28NOT%20categoryType:%22MEDIATYPE%22%29 
    :gives 292289 results


http://localhost:8983/solr/select?q=fmMediaType:%22text%22   :gives  
530 results


http://localhost:8983/solr/select?q=%28NOT%20categoryType:%22MEDIATYPE%22%29%20OR%20fmMediaType:%22text%22 
    :gives 530 results

I expected a number higher than the first query.

thanks
Joel


Re: NOT combined with OR is not getting exected results

Posted by Joel Nylund <jn...@yahoo.com>.
thanks that worked! and yes I have some with no categoryType

thanks
Joel

On Dec 2, 2009, at 2:24 PM, AHMET ARSLAN wrote:

>> Hi, thanks, but still get 530 results
>> for this new query your proposed.
>
>
> May be you have some documents that has empty categoryType field.
> Can you try this:
> q = ((*:* -categoryType:"MEDIATYPE") OR fmMediaType:"text")
>
> It should return at lest 292289 documents.
>
>
>


Re: NOT combined with OR is not getting exected results

Posted by AHMET ARSLAN <io...@yahoo.com>.
> Hi, thanks, but still get 530 results
> for this new query your proposed.


May be you have some documents that has empty categoryType field.
Can you try this:
q = ((*:* -categoryType:"MEDIATYPE") OR fmMediaType:"text")

It should return at lest 292289 documents. 


      

Re: NOT combined with OR is not getting exected results

Posted by Joel Nylund <jn...@yahoo.com>.
Hi, thanks, but still get 530 results for this new query your proposed.

thanks
Joel

On Dec 2, 2009, at 12:00 PM, AHMET ARSLAN wrote:

> http://localhost:8983/solr/select?q=%28NOT%20categoryType:%22MEDIATYPE%22%29 
>    :gives
>> 292289 results
>>
>>
>> http://localhost:8983/solr/select?q=fmMediaType:%22text%22   :gives
>> 530 results
>>
>>
>> http://localhost:8983/solr/select?q=%28NOT%20categoryType:%22MEDIATYPE%22%29%20OR%20fmMediaType:%22text%22 
>>    :gives
>> 530 results
>>
>> I expected a number higher than the first query.
>>
>
> NOT operator behaves a little bit different. It is like a filter.  
> You just can't combine OR and NOT directly.
>
> Try this:
> q=(categoryType:[* TO* ] NOT categoryType:"MEDIATYPE") OR  
> fmMediaType:"text"
>
>
> Solr allows q=(NOT categoryType:"MEDIATYPE") query but it can be  
> seen as q= *:* NOT categoryType:"MEDIATYPE"
>
> Hope this helps.
>
>
>
>
>


Re: NOT combined with OR is not getting exected results

Posted by AHMET ARSLAN <io...@yahoo.com>.
 http://localhost:8983/solr/select?q=%28NOT%20categoryType:%22MEDIATYPE%22%29   :gives
> 292289 results
> 
> 
> http://localhost:8983/solr/select?q=fmMediaType:%22text%22   :gives
> 530 results
> 
> 
> http://localhost:8983/solr/select?q=%28NOT%20categoryType:%22MEDIATYPE%22%29%20OR%20fmMediaType:%22text%22   :gives
> 530 results
> 
> I expected a number higher than the first query.
> 

NOT operator behaves a little bit different. It is like a filter. You just can't combine OR and NOT directly.

Try this:
q=(categoryType:[* TO* ] NOT categoryType:"MEDIATYPE") OR fmMediaType:"text"


Solr allows q=(NOT categoryType:"MEDIATYPE") query but it can be seen as q= *:* NOT categoryType:"MEDIATYPE"

Hope this helps.