lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack Krupansky" <>
Subject Re: query filter with OR reduces results
Date Tue, 03 Jul 2012 03:12:53 GMT
Purely negative queries are problematic. You need to add a "*:*":

(*:* NOT sentence_id:[* TO *])

Meaning all documents except those with values in the sentence_id field.

-- Jack Krupansky

-----Original Message----- 
From: Breese,John
Sent: Monday, July 02, 2012 11:19 AM
Subject: query filter with OR reduces results

I'm trying to figure out why adding an "OR" condition to a query filter 
would end up restricting results, instead of unioning them? I would expect 
to get back more results by adding a union to the filter query.

Case 1 – 380 Results

380 results are returned with a query of xyz with a query filter of

(NOT sentence_id:[* TO *])

Case 2 – 41 Results

41 results are returned with the same query and a filter query of


Case 3 – Union of Case 1 and 2

Only 41 results are returned using the same query and a filter query of

(NOT sentence_id:[* TO *])



I would expect that I would get at least 380 results with the union, instead 
of the 41 that I am seeing.

I only really notice this issue when using the NOT operator, so perhaps the 
problem lies with not understanding quite how the NOT operator is applied 
here. Any ideas?

I'm testing using the Solr /admin/form.jsp

Solr Implementation Version: 3.6.0 1310449 - rmuir - 2012-04-06 11:34:53

The default query parser is EDisMax, though I don't think that will change 
the filter queries.

CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities 
laws. Unauthorized forwarding, printing, copying, distribution, or use of 
such information is strictly prohibited and may be unlawful. If you are not 
the addressee, please promptly delete this message and notify the sender of 
the delivery error by e-mail or you may call Cerner's corporate offices in 
Kansas City, Missouri, U.S.A at (+1) (816)221-1024. 

View raw message