Lucene90HnswGraphBuilder (Lucene 10.5.1 backward-codecs API)
Description: declaration: package: org.apache.lucene.backward_codecs.lucene90, class: Lucene90HnswGraphBuilder

Package org.apache.lucene.backward_codecs.lucene90

# Class Lucene90HnswGraphBuilder

java.lang.Object
org.apache.lucene.backward_codecs.lucene90.Lucene90HnswGraphBuilder

public final class Lucene90HnswGraphBuilder extends Object
Builder for HNSW graph. See `Lucene90OnHeapHnswGraph` for a gloss on the algorithm and the meaning of the hyperparameters.

This class is preserved here only for tests.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `HNSW_COMPONENT`
  A name for the HNSW component for the info-stream *
  `static long`
  `randSeed`
  Random seed for level generation; public to expose for testing *

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Lucene90HnswGraphBuilder(FloatVectorValues vectors, VectorSimilarityFunction similarityFunction, int maxConn, int beamWidth, long seed)`
  Reads all the vectors from vector values, builds a graph connecting them by their dense ordinals, using the given hyperparameter settings, and returns the resulting graph.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Lucene90OnHeapHnswGraph`
  `build(FloatVectorValues vectors)`
  Reads all the vectors from two copies of a `FloatVectorValues`.
  `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`

- ## Field Details

  - ### HNSW_COMPONENT

    public static final String HNSW_COMPONENT
    A name for the HNSW component for the info-stream *
    See Also:
      - Constant Field Values

  - ### randSeed

    public static long randSeed
    Random seed for level generation; public to expose for testing *

- ## Constructor Details

  - ### Lucene90HnswGraphBuilder

    public Lucene90HnswGraphBuilder(FloatVectorValues vectors, VectorSimilarityFunction similarityFunction, int maxConn, int beamWidth, long seed) throws IOException
    Reads all the vectors from vector values, builds a graph connecting them by their dense ordinals, using the given hyperparameter settings, and returns the resulting graph.
    Parameters:
      `vectors` - the vectors whose relations are represented by the graph - must provide a different view over those vectors than the one used to add via addGraphNode.
      `maxConn` - the number of connections to make when adding a new graph node; roughly speaking the graph fanout.
      `beamWidth` - the size of the beam search to use when finding nearest neighbors.
      `seed` - the seed for a random number generator used during graph construction. Provide this to ensure repeatable construction.
    Throws:
      `IOException`

- ## Method Details

  - ### build

    public Lucene90OnHeapHnswGraph build(FloatVectorValues vectors) throws IOException
    Reads all the vectors from two copies of a `FloatVectorValues`. Providing two copies enables efficient retrieval without extra data copying, while avoiding collision of the returned values.
    Parameters:
      `vectors` - the vectors for which to build a nearest neighbors graph. Must be an independet accessor for the vectors
    Throws:
      `IOException`

  - ### setInfoStream

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