Class BitDocSet

java.lang.Object
org.apache.solr.search.DocSet
org.apache.solr.search.BitDocSet
All Implemented Interfaces:
Cloneable, org.apache.lucene.util.Accountable

public class BitDocSet extends DocSet
A FixedBitSet based implementation of a DocSet. Good for medium/large sets.
Since:
solr 0.9
  • Field Summary

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

    NULL_ACCOUNTABLE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    BitDocSet(org.apache.lucene.util.FixedBitSet bits)
    Construct a BitDocSet.
    BitDocSet(org.apache.lucene.util.FixedBitSet bits, int size)
    Construct a BitDocSet, and provides the number of set bits.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addAllTo(org.apache.lucene.util.FixedBitSet target)
    Adds all the docs from this set to the target.
    protected static void
    andNot(org.apache.lucene.util.FixedBitSet bits, DocSet other)
    Helper method for andNot that takes FixedBitSet and 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.
     
    boolean
    exists(int doc)
    Returns true of the doc exists in the set.
    org.apache.lucene.util.FixedBitSet
    A Bits that has fast random access (as is generally required of Bits).
    Collection<org.apache.lucene.util.Accountable>
     
    protected org.apache.lucene.util.FixedBitSet
     
    protected org.apache.lucene.util.FixedBitSet
     
    Returns the intersection of this set with another set.
    int
    Returns the number of documents of the intersection of this set with another set.
    boolean
    Returns true if these sets have any elements in common
    Returns an ordered iterator of the documents in the set.
    org.apache.lucene.search.DocIdSetIterator
    iterator(org.apache.lucene.index.LeafReaderContext context)
    Returns an ordered iterator of the documents in the set for the specified LeafReaderContext.
    org.apache.solr.search.DocSetQuery
    Returns a Query matching these documents with a score of 1.
    long
     
    int
    Returns the number of documents in the set.
     
    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 org.apache.solr.search.DocSet

    empty

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • BitDocSet

      public BitDocSet()
    • BitDocSet

      public BitDocSet(org.apache.lucene.util.FixedBitSet bits)
      Construct a BitDocSet. The capacity of the FixedBitSet should be at least maxDoc()
    • BitDocSet

      public BitDocSet(org.apache.lucene.util.FixedBitSet bits, int size)
      Construct a BitDocSet, and provides the number of set bits. The capacity of the FixedBitSet should be at least maxDoc()
  • Method Details

    • iterator

      public DocIterator iterator()
      Description copied from class: DocSet
      Returns an ordered iterator of the documents in the set. Any scoring information is meaningless.
      Specified by:
      iterator in class DocSet
    • getBits

      public org.apache.lucene.util.FixedBitSet getBits()
      Description copied from class: DocSet
      A Bits that has fast random access (as is generally required of Bits). It may be necessary to do work to build this.
      Specified by:
      getBits in class DocSet
      Returns:
      the internal FixedBitSet that should not be modified.
    • getFixedBitSet

      protected org.apache.lucene.util.FixedBitSet getFixedBitSet()
      Specified by:
      getFixedBitSet in class DocSet
    • getFixedBitSetClone

      protected org.apache.lucene.util.FixedBitSet getFixedBitSetClone()
      Specified by:
      getFixedBitSetClone in class DocSet
    • size

      public int size()
      Description copied from class: DocSet
      Returns the number of documents in the set.
      Specified by:
      size in class DocSet
    • exists

      public boolean exists(int doc)
      Returns true of the doc exists in the set. Should only be called when doc < FixedBitSet.length().
      Specified by:
      exists in class DocSet
    • intersection

      public DocSet intersection(DocSet other)
      Description copied from class: DocSet
      Returns the intersection of this set with another set. Neither set is modified - a new DocSet is created and returned.
      Specified by:
      intersection in class DocSet
      Returns:
      a DocSet representing the intersection
    • intersectionSize

      public int intersectionSize(DocSet other)
      Description copied from class: DocSet
      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.
      Specified by:
      intersectionSize in class DocSet
    • intersects

      public boolean intersects(DocSet other)
      Description copied from class: DocSet
      Returns true if these sets have any elements in common
      Specified by:
      intersects in class DocSet
    • unionSize

      public int unionSize(DocSet other)
      Description copied from class: DocSet
      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.
      Overrides:
      unionSize in class DocSet
    • andNotSize

      public int andNotSize(DocSet other)
      Description copied from class: DocSet
      Returns the number of documents in this set that are not in the other set.
      Overrides:
      andNotSize in class DocSet
    • addAllTo

      public void addAllTo(org.apache.lucene.util.FixedBitSet target)
      Description copied from class: DocSet
      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.
      Specified by:
      addAllTo in class DocSet
    • andNot

      public DocSet andNot(DocSet other)
      Description copied from class: DocSet
      Returns the documents in this set that are not in the other set. Neither set is modified - a new DocSet is created and returned.
      Specified by:
      andNot in class DocSet
      Returns:
      a DocSet representing this AND NOT other
    • andNot

      protected static void andNot(org.apache.lucene.util.FixedBitSet bits, DocSet other)
      Helper method for andNot that takes FixedBitSet and DocSet. This modifies the provided FixedBitSet to remove all bits contained in the DocSet argument -- equivalent to calling a.andNot(b), but modifies the state of the FixedBitSet instead of returning a new FixedBitSet.
      Parameters:
      bits - FixedBitSet to operate on
      other - The DocSet to compare to
    • union

      public DocSet union(DocSet other)
      Description copied from class: DocSet
      Returns the union of this set with another set. Neither set is modified - a new DocSet is created and returned.
      Specified by:
      union in class DocSet
      Returns:
      a DocSet representing the union
    • clone

      public BitDocSet clone()
      Specified by:
      clone in class DocSet
    • iterator

      public org.apache.lucene.search.DocIdSetIterator iterator(org.apache.lucene.index.LeafReaderContext context)
      Description copied from class: DocSet
      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.
      Specified by:
      iterator in class DocSet
    • makeQuery

      public org.apache.solr.search.DocSetQuery makeQuery()
      Description copied from class: DocSet
      Returns a Query matching these documents with a score of 1. Note that DocSets do not refer to deleted docs.
      Specified by:
      makeQuery in class DocSet
    • ramBytesUsed

      public long ramBytesUsed()
    • getChildResources

      public Collection<org.apache.lucene.util.Accountable> getChildResources()
    • toString

      public String toString()
      Overrides:
      toString in class Object