- Fixed bug 20290

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20290
- Added @version.


git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150033 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Otis Gospodnetic 2003-09-16 12:52:10 +00:00
parent 2310d71e07
commit 2357f0c106
1 changed files with 7 additions and 2 deletions

View File

@ -68,10 +68,12 @@ import org.apache.lucene.index.IndexReader;
* QueryFilter that matches, e.g., only documents modified within the last
* week. The QueryFilter and RangeQuery would only need to be reconstructed
* once per day.
*
* @version $Id$
*/
public class QueryFilter extends Filter {
private Query query;
private transient WeakHashMap cache = new WeakHashMap();
private transient WeakHashMap cache = null;
/** Constructs a filter which only matches documents matching
* <code>query</code>.
@ -82,6 +84,10 @@ public class QueryFilter extends Filter {
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) {
@ -97,7 +103,6 @@ public class QueryFilter extends Filter {
}
});
synchronized (cache) { // update cache
cache.put(reader, bits);
}