Class Lucene102HnswBinaryQuantizedVectorsFormat
java.lang.Object
org.apache.lucene.codecs.KnnVectorsFormat
org.apache.lucene.codecs.lucene102.Lucene102HnswBinaryQuantizedVectorsFormat
- All Implemented Interfaces:
NamedSPILoader.NamedSPI
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
FieldsFields inherited from class org.apache.lucene.codecs.KnnVectorsFormat
DEFAULT_MAX_DIMENSIONS, EMPTY
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a format using default graph construction parametersLucene102HnswBinaryQuantizedVectorsFormat
(int maxConn, int beamWidth) Constructs a format using the given 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 TypeMethodDescriptionfieldsReader
(SegmentReadState state) Returns aKnnVectorsReader
to read the vectors from the index.fieldsWriter
(SegmentWriteState state) Returns aKnnVectorsWriter
to write the vectors to the index.int
getMaxDimensions
(String fieldName) Returns the maximum number of vector dimensions supported by this codec for the given field nametoString()
Methods inherited from class org.apache.lucene.codecs.KnnVectorsFormat
availableKnnVectorsFormats, forName, getName, reloadKnnVectorsFormat
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
Lucene102HnswBinaryQuantizedVectorsFormat
public Lucene102HnswBinaryQuantizedVectorsFormat()Constructs a format using default graph construction parameters -
Lucene102HnswBinaryQuantizedVectorsFormat
public Lucene102HnswBinaryQuantizedVectorsFormat(int maxConn, int beamWidth) Constructs a format using the given graph construction parameters.- Parameters:
maxConn
- the maximum number of connections to a node in the HNSW graphbeamWidth
- the size of the queue maintained during graph construction.
-
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 graphbeamWidth
- 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-nullExecutorService
must be passed as mergeExecmergeExec
- theExecutorService
that will be used by ALL vector writers that are generated by this format to do the merge
-
-
Method Details
-
fieldsWriter
Description copied from class:KnnVectorsFormat
Returns aKnnVectorsWriter
to write the vectors to the index.- Specified by:
fieldsWriter
in classKnnVectorsFormat
- Throws:
IOException
-
fieldsReader
Description copied from class:KnnVectorsFormat
Returns aKnnVectorsReader
to read the vectors from the index.- Specified by:
fieldsReader
in classKnnVectorsFormat
- Throws:
IOException
-
getMaxDimensions
Description copied from class:KnnVectorsFormat
Returns the maximum number of vector dimensions supported by this codec for the given field nameCodecs implement this method to specify the maximum number of dimensions they support.
- Specified by:
getMaxDimensions
in classKnnVectorsFormat
- Parameters:
fieldName
- the field name- Returns:
- the maximum number of vector dimensions.
-
toString
-