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 "Breese,John" <Jo...@Cerner.com> on 2012/07/02 18:19:00 UTC
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
(usage_flags:PRESCRIPTION)
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 *])
OR
(usage_flags:PRESCRIPTION)
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.
Re: query filter with OR reduces results
Posted by Jack Krupansky <ja...@basetechnology.com>.
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
To: solr-user@lucene.apache.org
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
(usage_flags:PRESCRIPTION)
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 *])
OR
(usage_flags:PRESCRIPTION)
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.