lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <>
Subject Re: Using Filters in Lucene
Date Mon, 29 Jul 2002 17:02:52 GMT
Peter Carlson wrote:
> Would you suggest that search in selection type functionality use filters or
> redo the search with an AND clause?

I'm not sure I fully understand the question.

If you a condition that is likely to re-occur commonly in subsequent 
queries, then using a Filter which caches its bit vector is much faster 
than using an AND clause.  However, you probably cannot afford to keep a 
large number of such filters around, as the cached bit vectors use a 
fair amount of memory--one bit per document in the index.

Perhaps the ultimate filter is something like the attached class, 
QueryFilter.  This caches the results of an arbitrary query in a bit 
vector.  The filter can then be reused with multiple queries, and (so 
long as the index isn't altered) that part of the query computation will 
be cached.  For example, RangeQuery could be used with this, instead of 
using DateFilter, which does not cache (yet).

Caution: I have not yet tested this code.  If someone does try it, 
please send a message to the list telling how it goes.  If this is 
useful, I can document it better and add it to Lucene.


View raw message