Class DocIdSetBuilder

java.lang.Object
org.apache.lucene.util.DocIdSetBuilder

public final class DocIdSetBuilder extends Object
A builder of DocIdSets. At first it uses a sparse structure to gather documents, and then upgrades to a non-sparse bit set once enough hits match.

To add documents, you first need to call grow(int) in order to reserve space, and then call DocIdSetBuilder.BulkAdder.add(int) on the returned DocIdSetBuilder.BulkAdder.

  • Field Details

    • maxDoc

      private final int maxDoc
    • threshold

      private final int threshold
    • multivalued

      final boolean multivalued
    • numValuesPerDoc

      final double numValuesPerDoc
    • buffers

      private List<DocIdSetBuilder.Buffer> buffers
    • totalAllocated

      private int totalAllocated
    • bitSet

      private FixedBitSet bitSet
    • counter

      private long counter
    • adder

  • Constructor Details

    • DocIdSetBuilder

      public DocIdSetBuilder(int maxDoc)
      Create a builder that can contain doc IDs between 0 and maxDoc.
    • DocIdSetBuilder

      public DocIdSetBuilder(int maxDoc, Terms terms) throws IOException
      Create a DocIdSetBuilder instance that is optimized for accumulating docs that match the given Terms.
      Throws:
      IOException
    • DocIdSetBuilder

      public DocIdSetBuilder(int maxDoc, PointValues values, String field) throws IOException
      Create a DocIdSetBuilder instance that is optimized for accumulating docs that match the given PointValues.
      Throws:
      IOException
    • DocIdSetBuilder

      DocIdSetBuilder(int maxDoc, int docCount, long valueCount)
  • Method Details