Package org.apache.solr.search
Class DocSet
java.lang.Object
org.apache.solr.search.DocSet
- All Implemented Interfaces:
Cloneable,org.apache.lucene.util.Accountable
- Direct Known Subclasses:
BitDocSet,SortedIntDocSet
public abstract class DocSet
extends Object
implements org.apache.lucene.util.Accountable, Cloneable
An immutable ordered set of Lucene Document Ids. It's similar to a Lucene
DocIdSet. Solr never puts a deleted document into a DocSet.
WARNING: Any DocSet returned from SolrIndexSearcher should not be modified as it may have been retrieved from a cache and could be shared.
-
Field Summary
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Method Summary
Modifier and TypeMethodDescriptionabstract voidaddAllTo(org.apache.lucene.util.FixedBitSet target) Adds all the docs from this set to the target.abstract DocSetReturns the documents in this set that are not in the other set.intandNotSize(DocSet other) Returns the number of documents in this set that are not in the other set.abstract DocSetclone()static DocSetempty()An empty instance (has no docs).abstract booleanexists(int docid) Returns true if a document is in the DocSet.abstract org.apache.lucene.util.BitsgetBits()ABitsthat has fast random access (as is generally required of Bits).protected abstract org.apache.lucene.util.FixedBitSetprotected abstract org.apache.lucene.util.FixedBitSetabstract DocSetintersection(DocSet other) Returns the intersection of this set with another set.abstract intintersectionSize(DocSet other) Returns the number of documents of the intersection of this set with another set.abstract booleanintersects(DocSet other) Returns true if these sets have any elements in commonabstract DocIteratoriterator()Returns an ordered iterator of the documents in the set.abstract org.apache.lucene.search.DocIdSetIteratoriterator(org.apache.lucene.index.LeafReaderContext ctx) Returns an ordered iterator of the documents in the set for the specifiedLeafReaderContext.abstract org.apache.lucene.search.QueryReturns a Query matching these documents with a score of 1.abstract intsize()Returns the number of documents in the set.abstract DocSetReturns the union of this set with another set.intReturns the number of documents of the union of this set with another set.Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.util.Accountable
getChildResources, ramBytesUsed
-
Method Details
-
empty
An empty instance (has no docs). -
size
public abstract int size()Returns the number of documents in the set. -
exists
public abstract boolean exists(int docid) Returns true if a document is in the DocSet. If you want to be guaranteed fast random access, usegetBits()instead. -
iterator
Returns an ordered iterator of the documents in the set. Any scoring information is meaningless. -
iterator
public abstract org.apache.lucene.search.DocIdSetIterator iterator(org.apache.lucene.index.LeafReaderContext ctx) Returns an ordered iterator of the documents in the set for the specifiedLeafReaderContext. NOTE: may return null if there are no matching documents for this leaf. -
intersection
Returns the intersection of this set with another set. Neither set is modified - a new DocSet is created and returned.- Returns:
- a DocSet representing the intersection
-
intersectionSize
Returns the number of documents of the intersection of this set with another set. May be more efficient than actually creating the intersection and then getting its size. -
intersects
Returns true if these sets have any elements in common -
union
Returns the union of this set with another set. Neither set is modified - a new DocSet is created and returned.- Returns:
- a DocSet representing the union
-
unionSize
Returns the number of documents of the union of this set with another set. May be more efficient than actually creating the union and then getting its size. -
andNot
Returns the documents in this set that are not in the other set. Neither set is modified - a new DocSet is created and returned.- Returns:
- a DocSet representing this AND NOT other
-
andNotSize
Returns the number of documents in this set that are not in the other set. -
makeQuery
public abstract org.apache.lucene.search.Query makeQuery()Returns a Query matching these documents with a score of 1. Note that DocSets do not refer to deleted docs. -
addAllTo
public abstract void addAllTo(org.apache.lucene.util.FixedBitSet target) Adds all the docs from this set to the target. The target should be sized large enough to accommodate all of the documents before calling this method. -
clone
-
getBits
public abstract org.apache.lucene.util.Bits getBits()ABitsthat has fast random access (as is generally required of Bits). It may be necessary to do work to build this. -
getFixedBitSet
protected abstract org.apache.lucene.util.FixedBitSet getFixedBitSet() -
getFixedBitSetClone
protected abstract org.apache.lucene.util.FixedBitSet getFixedBitSetClone()
-