Package org.apache.lucene.util.hnsw

# Interface HnswBuilder

All Known Implementing Classes:
  `HnswConcurrentMergeBuilder`, `HnswGraphBuilder`, `InitializedHnswGraphBuilder`, `MergingHnswGraphBuilder`

public interface HnswBuilder
Interface for builder building the `OnHeapHnswGraph`

WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Method Summary

  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`
  `getCompletedGraph()`
  Once this method is called no further updates to the graph are accepted (addGraphNode will throw IllegalStateException).
  `OnHeapHnswGraph`
  `getGraph()`
  `void`
  `setInfoStream(InfoStream infoStream)`
  Set info-stream to output debugging information

- ## Method Details

  - ### build

    OnHeapHnswGraph build(int maxOrd) throws IOException
    Adds all nodes to the graph up to the provided `maxOrd`.
    Parameters:
      `maxOrd` - The maximum ordinal (excluded) of the nodes to be added.
    Throws:
      `IOException`

  - ### addGraphNode

    void addGraphNode(int node) throws IOException
    Inserts a doc with vector value to the graph
    Throws:
      `IOException`

  - ### setInfoStream

    void setInfoStream(InfoStream infoStream)
    Set info-stream to output debugging information

  - ### getGraph

    OnHeapHnswGraph getGraph()

  - ### getCompletedGraph

    OnHeapHnswGraph getCompletedGraph() throws IOException
    Once this method is called no further updates to the graph are accepted (addGraphNode will throw IllegalStateException). Final modifications to the graph (eg patching up disconnected components, re-ordering node ids for better delta compression) may be triggered, so callers should expect this call to take some time.
    Throws:
      `IOException`