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

Package org.apache.lucene.backward_codecs.lucene102

# Class Lucene102HnswBinaryQuantizedVectorsFormat

java.lang.Object
org.apache.lucene.codecs.KnnVectorsFormat
org.apache.lucene.backward_codecs.lucene102.Lucene102HnswBinaryQuantizedVectorsFormat

All Implemented Interfaces:
  `NamedSPILoader.NamedSPI`

public class Lucene102HnswBinaryQuantizedVectorsFormat extends KnnVectorsFormat
A vectors format that uses HNSW graph to store and search for vectors. But vectors are binary quantized using `Lucene102BinaryQuantizedVectorsFormat` before being stored in the graph.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final int`
  `beamWidth`
  The number of candidate neighbors to track while searching the graph for each newly inserted node.
  `protected static final FlatVectorsFormat`
  `flatVectorsFormat`
  The format for storing, reading, merging vectors on disk
  `protected final int`
  `maxConn`
  Controls how many of the nearest neighbor candidates are connected to the new node.
  `protected final TaskExecutor`
  `mergeExec`
  The `TaskExecutor` that will be used to do merge.
  `protected final int`
  `numMergeWorkers`
  Number of workers (threads) that will be used when doing merge.

  ### Fields inherited from class org.apache.lucene.codecs.KnnVectorsFormat

  `DEFAULT_MAX_DIMENSIONS, EMPTY`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Lucene102HnswBinaryQuantizedVectorsFormat()`
  Constructs a format using default graph construction parameters
  `Lucene102HnswBinaryQuantizedVectorsFormat(int maxConn, int beamWidth, int numMergeWorkers, ExecutorService mergeExec)`
  Constructs a format using the given graph construction parameters and scalar quantization.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `KnnVectorsReader`
  `fieldsReader(SegmentReadState state)`
  `KnnVectorsWriter`
  `fieldsWriter(SegmentWriteState state)`
  `int`
  `getMaxDimensions(String fieldName)`
  `String`
  `toString()`

  ### Methods inherited from class org.apache.lucene.codecs.KnnVectorsFormat

  `availableKnnVectorsFormats, forName, getName, reloadKnnVectorsFormat`

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

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

- ## Field Details

  - ### maxConn

    protected final int maxConn
    Controls how many of the nearest neighbor candidates are connected to the new node. Defaults to `Lucene99HnswVectorsFormat.DEFAULT_MAX_CONN`. See `HnswGraph` for more details.

  - ### beamWidth

    protected final int beamWidth
    The number of candidate neighbors to track while searching the graph for each newly inserted node. Defaults to `Lucene99HnswVectorsFormat.DEFAULT_BEAM_WIDTH`. See `HnswGraph` for details.

  - ### flatVectorsFormat

    protected static final FlatVectorsFormat flatVectorsFormat
    The format for storing, reading, merging vectors on disk

  - ### numMergeWorkers

    protected final int numMergeWorkers
    Number of workers (threads) that will be used when doing merge.

  - ### mergeExec

    protected final TaskExecutor mergeExec
    The `TaskExecutor` that will be used to do merge.

- ## Constructor Details

  - ### Lucene102HnswBinaryQuantizedVectorsFormat

    public Lucene102HnswBinaryQuantizedVectorsFormat()
    Constructs a format using default graph construction parameters

  - ### Lucene102HnswBinaryQuantizedVectorsFormat

    public Lucene102HnswBinaryQuantizedVectorsFormat(int maxConn, int beamWidth, int numMergeWorkers, ExecutorService mergeExec)
    Constructs a format using the given graph construction parameters and scalar quantization.
    Parameters:
      `maxConn` - the maximum number of connections to a node in the HNSW graph
      `beamWidth` - the size of the queue maintained during graph construction.
      `numMergeWorkers` - number of workers (threads) that will be used when doing merge. If larger than 1, a non-null `ExecutorService` must be passed as mergeExec
      `mergeExec` - the `ExecutorService` that will be used by ALL vector writers that are generated by this format to do the merge

- ## Method Details

  - ### fieldsWriter

    public KnnVectorsWriter fieldsWriter(SegmentWriteState state) throws IOException
    Specified by:
      `fieldsWriter` in class `KnnVectorsFormat`
    Throws:
      `IOException`

  - ### fieldsReader

    public KnnVectorsReader fieldsReader(SegmentReadState state) throws IOException
    Specified by:
      `fieldsReader` in class `KnnVectorsFormat`
    Throws:
      `IOException`

  - ### getMaxDimensions

    public int getMaxDimensions(String fieldName)
    Specified by:
      `getMaxDimensions` in class `KnnVectorsFormat`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`