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 Type
    Method
    Description
    abstract void
    addAllTo(org.apache.lucene.util.FixedBitSet target)
    Adds all the docs from this set to the target.
    abstract DocSet
    andNot(DocSet other)
    Returns the documents in this set that are not in the other set.
    int
    Returns the number of documents in this set that are not in the other set.
    abstract DocSet
     
    static DocSet
    An empty instance (has no docs).
    abstract boolean
    exists(int docid)
    Returns true if a document is in the DocSet.
    abstract org.apache.lucene.util.Bits
    A Bits that has fast random access (as is generally required of Bits).
    protected abstract org.apache.lucene.util.FixedBitSet
     
    protected abstract org.apache.lucene.util.FixedBitSet
     
    abstract DocSet
    Returns the intersection of this set with another set.
    abstract int
    Returns the number of documents of the intersection of this set with another set.
    abstract boolean
    Returns true if these sets have any elements in common
    abstract DocIterator
    Returns an ordered iterator of the documents in the set.
    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 specified LeafReaderContext.
    abstract org.apache.lucene.search.Query
    Returns a Query matching these documents with a score of 1.
    abstract int
    Returns the number of documents in the set.
    abstract DocSet
    union(DocSet other)
    Returns the union of this set with another set.
    int
    Returns 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, wait

    Methods inherited from interface org.apache.lucene.util.Accountable

    getChildResources, ramBytesUsed
  • Method Details

    • empty

      public static DocSet 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, use getBits() instead.
    • iterator

      public abstract DocIterator 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 specified LeafReaderContext. NOTE: may return null if there are no matching documents for this leaf.
    • intersection

      public abstract DocSet intersection(DocSet other)
      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

      public abstract int intersectionSize(DocSet other)
      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

      public abstract boolean intersects(DocSet other)
      Returns true if these sets have any elements in common
    • union

      public abstract DocSet union(DocSet other)
      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

      public int unionSize(DocSet other)
      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

      public abstract DocSet andNot(DocSet other)
      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

      public int andNotSize(DocSet other)
      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

      public abstract DocSet clone()
      Overrides:
      clone in class Object
    • getBits

      public abstract org.apache.lucene.util.Bits getBits()
      A Bits that 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()