public class BitDocSet extends DocSetBase
BitDocSet represents an unordered set of Lucene Document Ids
using a BitSet. A set bit represents inclusion in the set for that document.| Modifier and Type | Field and Description |
|---|---|
(package private) org.apache.lucene.util.OpenBitSet |
bits |
(package private) int |
size |
| Constructor and Description |
|---|
BitDocSet() |
BitDocSet(org.apache.lucene.util.OpenBitSet bits)
Construct a BitDocSet.
|
BitDocSet(org.apache.lucene.util.OpenBitSet bits,
int size)
Construct a BitDocSet, and provides the number of set bits.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int doc)
Adds the specified document if it is not currently in the DocSet
(optional operation).
|
void |
addUnique(int doc)
Adds a document the caller knows is not currently in the DocSet
(optional operation).
|
DocSet |
andNot(DocSet other)
Returns the documents in this set that are not in the other set.
|
int |
andNotSize(DocSet other)
Returns the number of documents in this set that are not in the other set.
|
boolean |
exists(int doc)
Returns true if a document is in the DocSet.
|
org.apache.lucene.util.OpenBitSet |
getBits()
Inefficient base implementation.
|
int |
intersectionSize(DocSet other)
Returns the number of documents of the intersection of this set with another set.
|
void |
invalidateSize()
The number of set bits - size - is cached.
|
DocIterator |
iterator()
DocIterator using nextSetBit()
public DocIterator iterator() {
return new DocIterator() {
int pos=bits.nextSetBit(0);
public boolean hasNext() {
return pos>=0;
}
public Integer next() {
return nextDoc();
}
public void remove() {
bits.clear(pos);
}
public int nextDoc() {
int old=pos;
pos=bits.nextSetBit(old+1);
return old;
}
public float score() {
return 0.0f;
}
};
}
|
long |
memSize()
Returns the approximate amount of memory taken by this DocSet.
|
int |
size()
Returns the number of documents in the set.
|
DocSet |
union(DocSet other)
Returns the union of this set with another set.
|
int |
unionSize(DocSet other)
Returns the number of documents of the union of this set with another set.
|
equals, getTopFilter, intersectionpublic BitDocSet()
public BitDocSet(org.apache.lucene.util.OpenBitSet bits)
public BitDocSet(org.apache.lucene.util.OpenBitSet bits,
int size)
public DocIterator iterator()
public org.apache.lucene.util.OpenBitSet getBits()
DocSetBasegetBits in interface DocSetgetBits in class DocSetBasegetBits()public void add(int doc)
DocSetadd in interface DocSetadd in class DocSetBaseDocSet.addUnique(int)public void addUnique(int doc)
DocSet
This method may be faster then add(doc) in some
implementaions provided the caller is certain of the precondition.
addUnique in interface DocSetaddUnique in class DocSetBaseDocSet.add(int)public int size()
DocSetpublic void invalidateSize()
public boolean exists(int doc)
DocSetpublic int intersectionSize(DocSet other)
DocSetintersectionSize in interface DocSetintersectionSize in class DocSetBasepublic int unionSize(DocSet other)
DocSetunionSize in interface DocSetunionSize in class DocSetBasepublic int andNotSize(DocSet other)
DocSetandNotSize in interface DocSetandNotSize in class DocSetBasepublic DocSet andNot(DocSet other)
DocSetandNot in interface DocSetandNot in class DocSetBasepublic DocSet union(DocSet other)
DocSetunion in interface DocSetunion in class DocSetBasepublic long memSize()
DocSet