lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r722174 - in /lucene/java/trunk: ./ contrib/miscellaneous/src/java/org/apache/lucene/misc/ contrib/queries/src/java/org/apache/lucene/search/ src/java/org/apache/lucene/search/
Date Mon, 01 Dec 2008 18:50:46 GMT
Author: mikemccand
Date: Mon Dec  1 10:50:45 2008
New Revision: 722174

URL: http://svn.apache.org/viewvc?rev=722174&view=rev
Log:
LUCENE-1296: add protected method CachingWrapperFilter.docIdSetToCache

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/contrib/miscellaneous/src/java/org/apache/lucene/misc/ChainedFilter.java
    lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/BooleanFilter.java
    lucene/java/trunk/src/java/org/apache/lucene/search/CachingWrapperFilter.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=722174&r1=722173&r2=722174&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Mon Dec  1 10:50:45 2008
@@ -105,6 +105,10 @@
     slower first-time usage due to populating the FieldCache.  (Tim
     Sturge via Mike McCandless)
 
+ 8. LUCENE-1296: add protected method CachingWrapperFilter.docIdSetToCache 
+    to allow subclasses to choose which DocIdSet implementation to use
+    (Paul Elschot via Mike McCandless)
+
 Optimizations
 
  1. LUCENE-1427: Fixed QueryWrapperFilter to not waste time computing

Modified: lucene/java/trunk/contrib/miscellaneous/src/java/org/apache/lucene/misc/ChainedFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/miscellaneous/src/java/org/apache/lucene/misc/ChainedFilter.java?rev=722174&r1=722173&r2=722174&view=diff
==============================================================================
--- lucene/java/trunk/contrib/miscellaneous/src/java/org/apache/lucene/misc/ChainedFilter.java
(original)
+++ lucene/java/trunk/contrib/miscellaneous/src/java/org/apache/lucene/misc/ChainedFilter.java
Mon Dec  1 10:50:45 2008
@@ -176,8 +176,13 @@
         }
         return result;
     }
-    
-    /** Provide a SortedVIntList when it is definitely smaller than an OpenBitSet */
+
+    // TODO: in 3.0, instead of removing this deprecated
+    // method, make it a no-op and mark it final
+    /** Provide a SortedVIntList when it is definitely
+     *  smaller than an OpenBitSet
+     *  @deprecated Either use CachingWrapperFilter, or
+     *  switch to a different DocIdSet implementation yourself. */
     protected DocIdSet finalResult(OpenBitSetDISI result, int maxDocs) {
         return (result.cardinality() < (maxDocs / 9))
               ? (DocIdSet) new SortedVIntList(result)

Modified: lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/BooleanFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/BooleanFilter.java?rev=722174&r1=722173&r2=722174&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/BooleanFilter.java
(original)
+++ lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/BooleanFilter.java
Mon Dec  1 10:50:45 2008
@@ -19,11 +19,9 @@
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.BitSet;
 
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.search.BooleanClause.Occur;
-import org.apache.lucene.util.DocIdBitSet;
 import org.apache.lucene.util.OpenBitSet;
 import org.apache.lucene.util.OpenBitSetDISI;
 import org.apache.lucene.util.SortedVIntList;
@@ -116,7 +114,12 @@
     return emptyDocIdSet;
   }
 
-  /** Provide a SortedVIntList when it is definitely smaller than an OpenBitSet */
+  // TODO: in 3.0, instead of removing this deprecated
+  // method, make it a no-op and mark it final
+  /** Provide a SortedVIntList when it is definitely smaller
+   * than an OpenBitSet.
+   * @deprecated Either use CachingWrapperFilter, or
+   * switch to a different DocIdSet implementation yourself. */
   protected DocIdSet finalResult(OpenBitSetDISI result, int maxDocs) {
     return (result.cardinality() < (maxDocs / 9))
       ? (DocIdSet) new SortedVIntList(result)

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/CachingWrapperFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/CachingWrapperFilter.java?rev=722174&r1=722173&r2=722174&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/CachingWrapperFilter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/CachingWrapperFilter.java Mon Dec
 1 10:50:45 2008
@@ -73,6 +73,14 @@
 
     return bits;
   }
+
+  /** Provide the DocIdSet to be cached, using the DocIdSet provided
+   *  by the wrapped Filter.
+   *  This implementation returns the given DocIdSet.
+   */
+  protected DocIdSet docIdSetToCache(DocIdSet docIdSet, IndexReader reader) {
+    return docIdSet;
+  }
   
   public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
     if (cache == null) {
@@ -91,7 +99,7 @@
         return new DocIdBitSet((BitSet) cached);
     }
 
-    final DocIdSet docIdSet = filter.getDocIdSet(reader);
+    final DocIdSet docIdSet = docIdSetToCache(filter.getDocIdSet(reader), reader);
 
     synchronized (cache) {  // update cache
       cache.put(reader, docIdSet);



Mime
View raw message