lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r738895 - in /lucene/java/trunk: contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeFilter.java src/java/org/apache/lucene/search/DocIdSet.java
Date Thu, 29 Jan 2009 15:39:11 GMT
Author: mikemccand
Date: Thu Jan 29 15:39:11 2009
New Revision: 738895

URL: http://svn.apache.org/viewvc?rev=738895&view=rev
Log:
LUCENE-1507: add DocIdSet.EMPTY_DOCIDSET

Modified:
    lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeFilter.java
    lucene/java/trunk/src/java/org/apache/lucene/search/DocIdSet.java

Modified: lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeFilter.java?rev=738895&r1=738894&r2=738895&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeFilter.java
(original)
+++ lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeFilter.java
Thu Jan 29 15:39:11 2009
@@ -27,7 +27,6 @@
 import org.apache.lucene.index.TermEnum;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.util.OpenBitSet;
-import org.apache.lucene.util.SortedVIntList;
 
 /**
  * Implementation of a Lucene {@link Filter} that implements trie-based range filtering.
@@ -261,7 +260,7 @@
     if (min.compareTo(max) > 0) {
       // shortcut: if min>max, no docs will match!
       lastNumberOfTerms=0;
-      return EMPTY_DOCIDSET;
+      return DocIdSet.EMPTY_DOCIDSET;
     } else {
       final OpenBitSet bits = new OpenBitSet(reader.maxDoc());
       final TermDocs termDocs = reader.termDocs();
@@ -295,6 +294,4 @@
   private final boolean minInclusive,maxInclusive;
   private Object minUnconverted,maxUnconverted;
   private int lastNumberOfTerms=-1;
-  
-  private static final DocIdSet EMPTY_DOCIDSET = new SortedVIntList(new int[0]);
 }

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/DocIdSet.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/DocIdSet.java?rev=738895&r1=738894&r2=738895&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/DocIdSet.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/DocIdSet.java Thu Jan 29 15:39:11
2009
@@ -18,11 +18,18 @@
  */
 
 import java.io.IOException;
+import org.apache.lucene.util.SortedVIntList;
 
 /**
- * A DocIdSet contains a set of doc ids. Implementing classes must provide
- * a {@link DocIdSetIterator} to access the set. 
+ * A DocIdSet contains a set of doc ids. Implementing classes must
+ * only implement {@link #iterator} to provide access to the set. 
  */
 public abstract class DocIdSet {
-	public abstract DocIdSetIterator iterator() throws IOException;
+
+  /** An empty {@code DocIdSet} instance for easy use (this is currently
+   * implemented using a {@link SortedVIntList}). */
+  public static final DocIdSet EMPTY_DOCIDSET = new SortedVIntList(new int[0]);
+    
+  /** Provides a {@link DocIdSetIterator} to access the set. */
+  public abstract DocIdSetIterator iterator() throws IOException;
 }



Mime
View raw message