org.apache.lucene.util

## Class BitDocIdSet.Builder

- java.lang.Object
- - org.apache.lucene.util.BitDocIdSet.Builder

- Enclosing class:
    BitDocIdSet

      public static final class BitDocIdSet.Builder
      extends Object

  A builder of `DocIdSet`s that supports random access. If you don't need random access, you should rather use `DocIdSetBuilder`.
  NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BitDocIdSet.Builder(int maxDoc)` Create a new empty instance.
    `BitDocIdSet.Builder(int maxDoc, boolean full)` Create a new instance that can hold `maxDoc` documents and is optionally `full`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `and(DocIdSetIterator it)` Deprecated.
    `void` | `andNot(DocIdSetIterator it)` Deprecated.
    `BitDocIdSet` | `build()` Build a `DocIdSet` that contains all doc ids that have been added.
    `boolean` | `isDefinitelyEmpty()` Is this builder definitely empty? If so, `build()` will return null.
    `void` | `or(DocIdSetIterator it)` Add the content of the provided `DocIdSetIterator` to this builder.

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

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

- - ### Constructor Detail

    - #### BitDocIdSet.Builder

          public BitDocIdSet.Builder(int maxDoc,
                             boolean full)

      Create a new instance that can hold `maxDoc` documents and is optionally `full`.

    - #### BitDocIdSet.Builder

          public BitDocIdSet.Builder(int maxDoc)

      Create a new empty instance.

  - ### Method Detail

    - #### isDefinitelyEmpty

          public boolean isDefinitelyEmpty()

      Is this builder definitely empty? If so, `build()` will return null. This is usually the same as simply being empty but if this builder was constructed with the `full` option or if an iterator was passed that iterated over no documents, then we're not sure.

    - #### or

          public void or(DocIdSetIterator it)
                  throws IOException

      Add the content of the provided `DocIdSetIterator` to this builder.
      Throws:
        `IOException`

    - #### and

          @Deprecated
          public void and(DocIdSetIterator it)
                   throws IOException

      Deprecated.
      Removes from this builder documents that are not contained in `it`.
      Throws:
        `IOException`

    - #### andNot

          @Deprecated
          public void andNot(DocIdSetIterator it)
                      throws IOException

      Deprecated.
      Removes from this builder documents that are contained in `it`.
      Throws:
        `IOException`

    - #### build

          public BitDocIdSet build()

      Build a `DocIdSet` that contains all doc ids that have been added. This method may return `null` if no documents were addded to this builder. NOTE: this is a destructive operation, the builder should not be used anymore after this method has been called.

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.