lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kipping, Peter" <>
Subject RE: FilteredQuery and Boolean AND
Date Fri, 01 Apr 2005 16:13:41 GMT
Any ideas on this?  I have purchased your book, Lucene in Action, which
is quite good.  To make things easier, consider the example on p212.  In
item 4, when you combine the queries, what happens you combine them in
and AND fashion?  The book only has OR, which works.  Although it may
work since the book only has one filtered query, but what if you made
them both filtered queries and ANDed them?


-----Original Message-----
From: Kipping, Peter [] 
Sent: Friday, March 25, 2005 10:34 AM
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?


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message