Package org.apache.lucene.util.hnsw

## Class HnswConcurrentMergeBuilder

- java.lang.Object
- - org.apache.lucene.util.hnsw.HnswConcurrentMergeBuilder

- All Implemented Interfaces:
    `HnswBuilder`

      public class HnswConcurrentMergeBuilder
      extends Object
      implements HnswBuilder

  A graph builder that manages multiple workers, it only supports adding the whole graph all at once. It will spawn a thread for each worker and the workers will pick the work in batches.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `HnswConcurrentMergeBuilder​(TaskExecutor taskExecutor, int numWorker, RandomVectorScorerSupplier scorerSupplier, int M, int beamWidth, OnHeapHnswGraph hnsw, BitSet initializedNodes)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addGraphNode​(int node)` | Inserts a doc with vector value to the graph
    `OnHeapHnswGraph` | `build​(int maxOrd)` | Adds all nodes to the graph up to the provided `maxOrd`.
    `OnHeapHnswGraph` | `getGraph()` |
    `void` | `setInfoStream​(InfoStream infoStream)` | Set info-stream to output debugging information

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

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

- - ### Constructor Detail

    - #### HnswConcurrentMergeBuilder

          public HnswConcurrentMergeBuilder​(TaskExecutor taskExecutor,
                                            int numWorker,
                                            RandomVectorScorerSupplier scorerSupplier,
                                            int M,
                                            int beamWidth,
                                            OnHeapHnswGraph hnsw,
                                            BitSet initializedNodes)
                                     throws IOException

      Throws:
        `IOException`

  - ### Method Detail

    - #### build

          public OnHeapHnswGraph build​(int maxOrd)
                                throws IOException

      Description copied from interface: `HnswBuilder`
      Adds all nodes to the graph up to the provided `maxOrd`.
      Specified by:
        `build` in interface `HnswBuilder`
      Parameters:
        `maxOrd` - The maximum ordinal (excluded) of the nodes to be added.
      Throws:
        `IOException`

    - #### addGraphNode

          public void addGraphNode​(int node)
                            throws IOException

      Description copied from interface: `HnswBuilder`
      Inserts a doc with vector value to the graph
      Specified by:
        `addGraphNode` in interface `HnswBuilder`
      Throws:
        `IOException`

    - #### setInfoStream

          public void setInfoStream​(InfoStream infoStream)

      Description copied from interface: `HnswBuilder`
      Set info-stream to output debugging information
      Specified by:
        `setInfoStream` in interface `HnswBuilder`

    - #### getGraph

          public OnHeapHnswGraph getGraph()

      Specified by:
        `getGraph` in interface `HnswBuilder`