Index: src/java/org/apache/lucene/search/QueryFilter.java =================================================================== --- src/java/org/apache/lucene/search/QueryFilter.java (revision 525635) +++ src/java/org/apache/lucene/search/QueryFilter.java (working copy) @@ -18,14 +18,14 @@ */ import java.io.IOException; -import java.util.WeakHashMap; import java.util.BitSet; + import org.apache.lucene.index.IndexReader; /** Constrains search results to only match those which also match a provided - * query. Results are cached, so that searches after the first on the same - * index using this filter are much faster. - * + * query. Results are not cached. To cache the filter bits wrap the QueryFilter + * in the {@link org.apache.lucene.search.CachingWrapperFilter}. + * *

This could be used, for example, with a {@link RangeQuery} on a suitably * formatted date field to implement date filtering. One could re-use a single * QueryFilter that matches, e.g., only documents modified within the last @@ -36,7 +36,6 @@ */ public class QueryFilter extends Filter { private Query query; - private transient WeakHashMap cache = null; /** Constructs a filter which only matches documents matching * query. @@ -47,17 +46,6 @@ public BitSet bits(IndexReader reader) throws IOException { - if (cache == null) { - cache = new WeakHashMap(); - } - - synchronized (cache) { // check cache - BitSet cached = (BitSet) cache.get(reader); - if (cached != null) { - return cached; - } - } - final BitSet bits = new BitSet(reader.maxDoc()); new IndexSearcher(reader).search(query, new HitCollector() { @@ -66,10 +54,6 @@ } }); - synchronized (cache) { // update cache - cache.put(reader, bits); - } - return bits; }