RoaringDocIdSet.Builder (Lucene 10.5.1 core API)
Description: declaration: package: org.apache.lucene.util, class: RoaringDocIdSet, class: Builder

Package org.apache.lucene.util

# Class RoaringDocIdSet.Builder

java.lang.Object
org.apache.lucene.util.RoaringDocIdSet.Builder

Enclosing class:
  `RoaringDocIdSet`

public static class RoaringDocIdSet.Builder extends Object
A builder of `RoaringDocIdSet`s.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Builder(int maxDoc)`
  Sole constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `RoaringDocIdSet.Builder`
  `add(int docId)`
  Add a new doc-id to this builder.
  `RoaringDocIdSet.Builder`
  `add(int min, int max)`
  Add a contiguous half-open range `[min, max)` of doc ids.
  `RoaringDocIdSet.Builder`
  `add(DocIdSetIterator disi)`
  Add the content of the provided `DocIdSetIterator`.
  `RoaringDocIdSet`
  `build()`
  Build an instance.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Builder

    public Builder(int maxDoc)
    Sole constructor.

- ## Method Details

  - ### add

    public RoaringDocIdSet.Builder add(int docId)
    Add a new doc-id to this builder. NOTE: doc ids must be added in order.

  - ### add

    public RoaringDocIdSet.Builder add(int min, int max)
    Add a contiguous half-open range `[min, max)` of doc ids. Doc ids must remain in non-decreasing order relative to prior `add(int)` calls; `min` must be strictly greater than the last document added (if any). Equivalent to calling `add(int)` for each `min <= doc < max`, but uses a more efficient implementation for dense ranges.
    Parameters:
      `min` - inclusive lower bound (must be `>= 0`)
      `max` - exclusive upper bound
    Throws:
      `IllegalArgumentException` - if `min > max`, if `min <= lastDocId`, or if `max` exceeds `maxDoc`

  - ### add

    public RoaringDocIdSet.Builder add(DocIdSetIterator disi) throws IOException
    Add the content of the provided `DocIdSetIterator`.
    Throws:
      `IOException`

  - ### build

    public RoaringDocIdSet build()
    Build an instance.