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, unionSizestatic 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)
DocSetpublic int size()
DocSetpublic DocIterator iterator()
DocSetThe order of the documents returned by this iterator is non-deterministic, and any scoring information is meaningless
public long memSize()
DocSetpublic DocSet intersection(DocSet other)
DocSetintersection in interface DocSetintersection in class DocSetBasepublic int intersectionSize(DocSet other)
DocSetintersectionSize in interface DocSetintersectionSize in class DocSetBasepublic DocSet andNot(DocSet other)
DocSetandNot in interface DocSetandNot in class DocSetBasepublic DocSet union(DocSet other)
DocSetunion in interface DocSetunion in class DocSetBase