lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o...@apache.org
Subject cvs commit: jakarta-lucene/src/java/org/apache/lucene/search QueryFilter.java
Date Tue, 16 Sep 2003 12:52:10 GMT
otis        2003/09/16 05:52:10

  Modified:    src/java/org/apache/lucene/search QueryFilter.java
  Log:
  - Fixed bug 20290
    http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20290
  - Added @version.
  
  Revision  Changes    Path
  1.4       +7 -2      jakarta-lucene/src/java/org/apache/lucene/search/QueryFilter.java
  
  Index: QueryFilter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/QueryFilter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- QueryFilter.java	13 Sep 2003 23:40:29 -0000	1.3
  +++ QueryFilter.java	16 Sep 2003 12:52:10 -0000	1.4
  @@ -68,10 +68,12 @@
    * 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 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) {
  @@ -96,7 +102,6 @@
           bits.set(doc);  // set bit for hit
         }
       });
  -
   
       synchronized (cache) {  // update cache
         cache.put(reader, bits);
  
  
  

Mime
View raw message