lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kipping, Peter" <Peter.Kipp...@taylorandfrancis.com>
Subject RE: FilteredQuery and Boolean AND
Date Mon, 04 Apr 2005 20:47:51 GMT
Chris, thanks for your help.  I came to the same conclusions about using
the ChainedFilter.  However there are situations where applying a filter
at the end wouldn't work. Consider the same two filtered queries plus
and an OR:

(FilteredQuery1 AND FilteredQuery2) OR TermQuery

Where TermQuery can be pretty much anything.  The ChainedFilter would
restrict the TermQuery docs from appearing in the hits, even though it
shouldn't.  If the FilteredQuerys worked properly, they could be put in
a BooleanQuery and then a BooleanClause.  That's why I was doing that
way.

Peter

-----Original Message-----
From: hossman@hal.rescomp.berkeley.edu
[mailto:hossman@hal.rescomp.berkeley.edu] On Behalf Of Chris Hostetter
Sent: Friday, April 01, 2005 7:53 PM
To: java-user@lucene.apache.org
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




: Date: Fri, 1 Apr 2005 13:29:04 -0500
: From: Erik Hatcher <erik@ehatchersolutions.com>
: Reply-To: java-user@lucene.apache.org
: To: java-user@lucene.apache.org
: Subject: Re: FilteredQuery and Boolean AND
:
: Peter,
:
: Could you provide a straight-forward test case that indexes a few
: documents into a RAMDirectory and demonstrates the problem you're
: having with AND'd FilteredQuery's?
:
: Give me something concrete and simple and I'll dig into it further.
:
: 	Erik
:
: On Apr 1, 2005, at 11:13 AM, Kipping, Peter wrote:
:
: > 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?
: >
: > Thanks,
: > Peter
: >
: > -----Original Message-----
: > From: Kipping, Peter [mailto:Peter.Kipping@taylorandfrancis.com]
: > Sent: Friday, March 25, 2005 10:34 AM
: > To: java-user@lucene.apache.org
: > 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?
: >
: > Thanks,
: > Peter
: >
: >
: >
---------------------------------------------------------------------
: > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
: > For additional commands, e-mail: java-user-help@lucene.apache.org
: >
: >
: >
: >
: >
---------------------------------------------------------------------
: > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
: > For additional commands, e-mail: java-user-help@lucene.apache.org
:
:
: ---------------------------------------------------------------------
: To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
: For additional commands, e-mail: java-user-help@lucene.apache.org
:



-Hoss



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message