Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Cannot Reproduce
-
None
-
None
-
None
-
Operating System: other
Platform: Other
-
34279
Description
from java-user@lucene ...
: > From: Kipping, Peter
: > Sent: Friday, March 25, 2005 10:34 AM
: > To: java-user
: > Subject: FilteredQuery and Boolean AND
: >
: > I have the following query structure:
: >
: > BooleanQuery q2 = new BooleanQuery();
: > TermQuery tq = new TermQuery(new Term("all_entries", "y"));
: > FilteredQuery fq = new FilteredQuery(tq, ft);
: > FilteredQuery fq2 = new FilteredQuery(tq, ft2);
: > q2.add(fq, false, false);
: > q2.add(fq2, false, false);
: >
: > The two filters are searches over numeric ranges. I'm using filters so
: > I don't get the TooManyBooleanClauses Exception. And my TermQuery tq
: > is
: > just a field that has 'y' in every document so I can filter over the
: > entire index. The last two lines I am creating a boolean OR, and
: > everything works fine. I get back 30 documents which is correct.
: >
: > However when I change the last two lines to create an AND:
: >
: > q2.add(fq, true, false);
: > q2.add(fq2, true, false);
: >
: > I still get back 30 documents, which is not correct. It should be 0.
: > What's going on with FilteredQuery?
Date: Fri, 1 Apr 2005 16:52:55 -0800 (PST)
From: Chris Hostetter
To: java-user
Subject: Re: FilteredQuery and Boolean AND
Peter's problem intrigued me, so I wrote my own test case using two simple
Filters that filter out all but the first (or last) doc. I seem to be
getting the same results he is, which is certianly. see attached test case.
while this definitely seems like a bug, it also seems like a fairly
inefficinent way of approaching hte problem in general, instead of:
BooleanQuery containing:
a) FilteredQuery wrapping:
Query for "all" – filtered by – RangeFilter #1
b) FilteredQuery wrapping:
Query for "all" – filtered by – RangeFilter #2
...it seems like it would make more sense to use...
FilterQuery wrapping:
Query for all – filtered by – ChainedFilter containing:
a) RangeFilter #1
b) RangeFilter #2
-------------------------------
I'll attach the testcase momentarily