HnswGraphMerger (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.util.hnsw, interface: HnswGraphMerger

Package org.apache.lucene.util.hnsw

# Interface HnswGraphMerger

All Known Implementing Classes:
  `ConcurrentHnswMerger`, `IncrementalHnswGraphMerger`

public interface HnswGraphMerger
Abstraction of merging multiple graphs into one on-heap graph

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `HnswGraphMerger`
  `addReader(KnnVectorsReader reader, MergeState.DocMap docMap, Bits liveDocs)`
  Adds a reader to the graph merger to record the state
  `OnHeapHnswGraph`
  `merge(KnnVectorValues mergedVectorValues, InfoStream infoStream, int maxOrd)`
  Merge and produce the on heap graph

- ## Method Details

  - ### addReader

    HnswGraphMerger addReader(KnnVectorsReader reader, MergeState.DocMap docMap, Bits liveDocs) throws IOException
    Adds a reader to the graph merger to record the state
    Parameters:
      `reader` - KnnVectorsReader to add to the merger
      `docMap` - MergeState.DocMap for the reader
      `liveDocs` - Bits representing live docs, can be null
    Returns:
      this
    Throws:
      `IOException` - If an error occurs while reading from the merge state

  - ### merge

    OnHeapHnswGraph merge(KnnVectorValues mergedVectorValues, InfoStream infoStream, int maxOrd) throws IOException
    Merge and produce the on heap graph
    Parameters:
      `mergedVectorValues` - view of the vectors in the merged segment
      `infoStream` - optional info stream to set to builder
      `maxOrd` - max number of vectors that will be added to the graph
    Returns:
      merged graph
    Throws:
      `IOException` - during merge