mirror of https://github.com/apache/lucene.git
LUCENE-1507: add DocIdSet.EMPTY_DOCIDSET
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@738895 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
48c3220021
commit
20753f2e31
|
@ -27,7 +27,6 @@ import org.apache.lucene.index.TermDocs;
|
|||
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 @@ public final class TrieRangeFilter extends Filter {
|
|||
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 @@ public final class TrieRangeFilter extends Filter {
|
|||
private final boolean minInclusive,maxInclusive;
|
||||
private Object minUnconverted,maxUnconverted;
|
||||
private int lastNumberOfTerms=-1;
|
||||
|
||||
private static final DocIdSet EMPTY_DOCIDSET = new SortedVIntList(new int[0]);
|
||||
}
|
||||
|
|
|
@ -18,11 +18,18 @@ package org.apache.lucene.search;
|
|||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue