lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: BooleanQuery question
Date Sat, 22 Jul 2006 08:15:56 GMT

: >you can't have a boolean query containing only MUST_NOT clauses (which is
: >what (-(FILE:abstract.htm)) is.  it matches no documents, so the mandatory
: >qualification on it causes the query to fail for all docs.
:
: This is true for the search queries, but it makes sense in a query
: filter IMHO. I encountered this and had to add a MUST clause on the
: Filter with a trivial field in order not to break the Filter returning
: zero documents.
:
: Isn't this a conceptual bug in the case of constructing a filter along a
: query?

I'm a little confused by what you mean, but i suspect it realates to one
of the following two issues...

1) a QueryFilter just provides a simple wrapper arround a Query to make
developing a "Filter" (ie: a cachable mechanism for identifing documents
without scoring) easy if you already have a Query with the logic you want
-- wrapping a QueryFilter arround a BooleanQuery doesn't change any
intrinsic rules about how a BooleanQuery works -- it just uses the results
in a differnet way.

2) It's trivial to write a Filter that selects all items which do *not*
match a Query -- by writting a Filter that flips the bits on a BitSet from
another filter and wrapping that arround a QueryFilter -- but in the
context of "search" you still need a Query to execute to positively select
and score some documents.  Your filter is only consulted to determine if
those documents are allowed.  It's the same problem as the BooleanQuery -
to do a search you need to score some documents and saying "these
documents should be excluded" isn't enough information.  If all you care
about is the set of documents (and not any scoring) then call the bits
method on your filter directly.



-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