Lucene99HnswVectorsFormat

class Lucene99HnswVectorsFormat @JvmOverloads constructor(maxConn: Int = DEFAULT_MAX_CONN, beamWidth: Int = DEFAULT_BEAM_WIDTH, numMergeWorkers: Int = DEFAULT_NUM_MERGE_WORKER, mergeExec: ExecutorService? = null) : KnnVectorsFormat

Lucene 9.9 vector format, which encodes numeric vector values into an associated graph connecting the documents having values. The graph is used to power HNSW search. The format consists of two files, and requires a FlatVectorsFormat to store the actual vectors:

.vex (vector index)

Stores graphs connecting the documents for each field organized as a list of nodes' neighbours as following:

  • For each level:

  • For each node:

  • vint the number of neighbor nodes

  • arrayvint the delta encoded neighbor ordinals

  • After all levels are encoded, memory offsets for each node's neighbor nodes are appended to the end of the file. The offsets are encoded by [ ].

.vem (vector metadata) file

For each field:

  • int32 field number

  • int32 vector similarity function ordinal

  • vlong offset to this field's index in the .vex file

  • vlong length of this field's index data, in bytes

  • vint dimension of this field's vectors

  • int the number of documents having values for this field

  • vint the maximum number of connections (neighbours) that each node can have

  • vint number of levels in the graph

  • Graph nodes by level. For each level

  • vint the number of nodes on this level

  • arrayvint for levels greater than 0 list of nodes on this level, stored as the level 0th delta encoded nodes' ordinals.

Constructors

Link copied to clipboard
constructor(maxConn: Int = DEFAULT_MAX_CONN, beamWidth: Int = DEFAULT_BEAM_WIDTH, numMergeWorkers: Int = DEFAULT_NUM_MERGE_WORKER, mergeExec: ExecutorService? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open lateinit override var name: String

Functions

Link copied to clipboard

Returns a KnnVectorsReader to read the vectors from the index.

Link copied to clipboard

Returns a KnnVectorsWriter to write the vectors to the index.

Link copied to clipboard
open override fun getMaxDimensions(fieldName: String): Int

Returns the maximum number of vector dimensions supported by this codec for the given field name

Link copied to clipboard
open override fun toString(): String