public final class HashDocSet extends DocSetBase
HashDocSet
represents an unordered set of Lucene Document Ids
using a primitive int hash table. It can be a better choice if there are few docs
in the set because it takes up less memory and is faster to iterate and take
set intersections.Modifier and Type | Field and Description |
---|---|
(package private) static float |
DEFAULT_INVERSE_LOAD_FACTOR
Default load factor to use for HashDocSets.
|
private static int |
EMPTY |
private int |
mask |
private int |
size |
private int[] |
table |
Constructor and Description |
---|
HashDocSet(int[] docs,
int offset,
int len)
Create a HashDocSet from a list of *unique* ids
|
HashDocSet(int[] docs,
int offset,
int len,
float inverseLoadFactor)
Create a HashDocSet from a list of *unique* ids
|
Modifier and Type | Method and Description |
---|---|
DocSet |
andNot(DocSet other)
Returns the documents in this set that are not in the other set.
|
boolean |
exists(int doc)
Returns true if a document is in the DocSet.
|
DocSet |
intersection(DocSet other)
Returns the intersection of this set with another set.
|
int |
intersectionSize(DocSet other)
Returns the number of documents of the intersection of this set with another set.
|
DocIterator |
iterator()
Returns an iterator that may be used to iterate over all of the documents in the set.
|
long |
memSize()
Returns the approximate amount of memory taken by this DocSet.
|
(package private) void |
put(int doc) |
int |
size()
Returns the number of documents in the set.
|
DocSet |
union(DocSet other)
Returns the union of this set with another set.
|
add, addUnique, andNotSize, equals, getBits, getTopFilter, unionSize
static float DEFAULT_INVERSE_LOAD_FACTOR
private static final int EMPTY
private final int[] table
private final int size
private final int mask
public HashDocSet(int[] docs, int offset, int len)
public HashDocSet(int[] docs, int offset, int len, float inverseLoadFactor)
void put(int doc)
public boolean exists(int doc)
DocSet
public int size()
DocSet
public DocIterator iterator()
DocSet
The order of the documents returned by this iterator is non-deterministic, and any scoring information is meaningless
public long memSize()
DocSet
public DocSet intersection(DocSet other)
DocSet
intersection
in interface DocSet
intersection
in class DocSetBase
public int intersectionSize(DocSet other)
DocSet
intersectionSize
in interface DocSet
intersectionSize
in class DocSetBase
public DocSet andNot(DocSet other)
DocSet
andNot
in interface DocSet
andNot
in class DocSetBase
public DocSet union(DocSet other)
DocSet
union
in interface DocSet
union
in class DocSetBase