Class Lucene104HnswScalarQuantizedVectorsFormat
java.lang.Object
org.apache.lucene.codecs.KnnVectorsFormat
org.apache.lucene.codecs.lucene104.Lucene104HnswScalarQuantizedVectorsFormat
- All Implemented Interfaces:
NamedSPILoader.NamedSPI
A vectors format that uses HNSW graph to store and search for vectors. But vectors are binary
quantized using
Lucene104ScalarQuantizedVectorsFormat 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 parametersLucene104HnswScalarQuantizedVectorsFormat(int maxConn, int beamWidth) Constructs a format using the given graph construction parameters.Lucene104HnswScalarQuantizedVectorsFormat(Lucene104ScalarQuantizedVectorsFormat.ScalarEncoding encoding, int maxConn, int beamWidth) Constructs a format using the given graph construction parameters.Lucene104HnswScalarQuantizedVectorsFormat(Lucene104ScalarQuantizedVectorsFormat.ScalarEncoding encoding, int maxConn, int beamWidth, int numMergeWorkers, ExecutorService mergeExec) Constructs a format using the given graph construction parameters and scalar quantization.Lucene104HnswScalarQuantizedVectorsFormat(Lucene104ScalarQuantizedVectorsFormat.ScalarEncoding encoding, int maxConn, int beamWidth, int numMergeWorkers, ExecutorService mergeExec, int tinySegmentsThreshold) Constructs a format using the given graph construction parameters and scalar quantization. -
Method Summary
Modifier and TypeMethodDescriptionfieldsReader(SegmentReadState state) Returns aKnnVectorsReaderto read the vectors from the index.fieldsWriter(SegmentWriteState state) Returns aKnnVectorsWriterto write the vectors to the index.intgetMaxDimensions(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
-
Lucene104HnswScalarQuantizedVectorsFormat
public Lucene104HnswScalarQuantizedVectorsFormat()Constructs a format using default graph construction parameters -
Lucene104HnswScalarQuantizedVectorsFormat
public Lucene104HnswScalarQuantizedVectorsFormat(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.
-
Lucene104HnswScalarQuantizedVectorsFormat
public Lucene104HnswScalarQuantizedVectorsFormat(Lucene104ScalarQuantizedVectorsFormat.ScalarEncoding encoding, int maxConn, int beamWidth) Constructs a format using the given graph construction parameters.- Parameters:
encoding- the quantization encoding used to encode the vectorsmaxConn- the maximum number of connections to a node in the HNSW graphbeamWidth- the size of the queue maintained during graph construction.
-
Lucene104HnswScalarQuantizedVectorsFormat
public Lucene104HnswScalarQuantizedVectorsFormat(Lucene104ScalarQuantizedVectorsFormat.ScalarEncoding encoding, int maxConn, int beamWidth, int numMergeWorkers, ExecutorService mergeExec) Constructs a format using the given graph construction parameters and scalar quantization.- Parameters:
encoding- the quantization encoding used to encode the vectorsmaxConn- 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-nullExecutorServicemust be passed as mergeExecmergeExec- theExecutorServicethat will be used by ALL vector writers that are generated by this format to do the merge
-
Lucene104HnswScalarQuantizedVectorsFormat
public Lucene104HnswScalarQuantizedVectorsFormat(Lucene104ScalarQuantizedVectorsFormat.ScalarEncoding encoding, int maxConn, int beamWidth, int numMergeWorkers, ExecutorService mergeExec, int tinySegmentsThreshold) 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-nullExecutorServicemust be passed as mergeExecmergeExec- theExecutorServicethat will be used by ALL vector writers that are generated by this format to do the merge
-
-
Method Details
-
fieldsWriter
Description copied from class:KnnVectorsFormatReturns aKnnVectorsWriterto write the vectors to the index.- Specified by:
fieldsWriterin classKnnVectorsFormat- Throws:
IOException
-
fieldsReader
Description copied from class:KnnVectorsFormatReturns aKnnVectorsReaderto read the vectors from the index.- Specified by:
fieldsReaderin classKnnVectorsFormat- Throws:
IOException
-
getMaxDimensions
Description copied from class:KnnVectorsFormatReturns 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:
getMaxDimensionsin classKnnVectorsFormat- Parameters:
fieldName- the field name- Returns:
- the maximum number of vector dimensions.
-
toString
-