Class OffHeapQuantizedByteVectorValues
java.lang.Object
org.apache.lucene.index.KnnVectorValues
org.apache.lucene.index.ByteVectorValues
org.apache.lucene.util.quantization.QuantizedByteVectorValues
org.apache.lucene.codecs.lucene99.OffHeapQuantizedByteVectorValues
- All Implemented Interfaces:
HasIndexSlice
- Direct Known Subclasses:
OffHeapQuantizedByteVectorValues.DenseOffHeapVectorValues
Read the quantized vector values and their score correction values from the index input. This
supports both iterated and random access.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDense vector values that are stored off-heap.Nested classes/interfaces inherited from class org.apache.lucene.index.KnnVectorValues
KnnVectorValues.DocIndexIterator -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final byte[]protected final ByteBufferprotected final intprotected final booleanprotected final intprotected intprotected final intprotected final ScalarQuantizerprotected final float[]protected final VectorSimilarityFunctionprotected final intprotected final IndexInputprotected final FlatVectorsScorer -
Method Summary
Modifier and TypeMethodDescriptionintReturn the dimension of the vectorsfloatgetScoreCorrectionConstant(int targetOrd) getSlice()Returns an IndexInput from which to read this instance's values.intReturns the vector byte length, defaults to dimension multiplied by float byte sizeload(OrdToDocDISIReaderConfiguration configuration, int dimension, int size, ScalarQuantizer scalarQuantizer, VectorSimilarityFunction similarityFunction, FlatVectorsScorer vectorsScorer, boolean compress, long quantizedVectorDataOffset, long quantizedVectorDataLength, IndexInput vectorData) intsize()Return the number of vectors for this field.byte[]vectorValue(int targetOrd) Return the vector value for the given vector ordinal which must be in [0, size() - 1], otherwise IndexOutOfBoundsException is thrown.Methods inherited from class org.apache.lucene.util.quantization.QuantizedByteVectorValues
copy, scorerMethods inherited from class org.apache.lucene.index.ByteVectorValues
checkField, fromBytes, getEncoding, scorerMethods inherited from class org.apache.lucene.index.KnnVectorValues
createDenseIterator, createSparseIterator, fromDISI, getAcceptOrds, iterator, ordToDoc
-
Field Details
-
dimension
protected final int dimension -
size
protected final int size -
numBytes
protected final int numBytes -
scalarQuantizer
-
similarityFunction
-
vectorsScorer
-
compress
protected final boolean compress -
slice
-
binaryValue
protected final byte[] binaryValue -
byteBuffer
-
byteSize
protected final int byteSize -
lastOrd
protected int lastOrd -
scoreCorrectionConstant
protected final float[] scoreCorrectionConstant
-
-
Method Details
-
getScalarQuantizer
- Overrides:
getScalarQuantizerin classQuantizedByteVectorValues
-
dimension
public int dimension()Description copied from class:KnnVectorValuesReturn the dimension of the vectors- Specified by:
dimensionin classKnnVectorValues
-
size
public int size()Description copied from class:KnnVectorValuesReturn the number of vectors for this field.- Specified by:
sizein classKnnVectorValues- Returns:
- the number of vectors returned by this iterator
-
vectorValue
Description copied from class:ByteVectorValuesReturn the vector value for the given vector ordinal which must be in [0, size() - 1], otherwise IndexOutOfBoundsException is thrown. The returned array may be shared across calls.- Specified by:
vectorValuein classByteVectorValues- Returns:
- the vector value
- Throws:
IOException
-
getScoreCorrectionConstant
- Specified by:
getScoreCorrectionConstantin classQuantizedByteVectorValues- Throws:
IOException
-
getSlice
Description copied from interface:HasIndexSliceReturns an IndexInput from which to read this instance's values.- Specified by:
getSlicein interfaceHasIndexSlice- Overrides:
getSlicein classQuantizedByteVectorValues
-
getVectorByteLength
public int getVectorByteLength()Description copied from class:KnnVectorValuesReturns the vector byte length, defaults to dimension multiplied by float byte size- Overrides:
getVectorByteLengthin classKnnVectorValues
-
load
public static OffHeapQuantizedByteVectorValues load(OrdToDocDISIReaderConfiguration configuration, int dimension, int size, ScalarQuantizer scalarQuantizer, VectorSimilarityFunction similarityFunction, FlatVectorsScorer vectorsScorer, boolean compress, long quantizedVectorDataOffset, long quantizedVectorDataLength, IndexInput vectorData) throws IOException - Throws:
IOException
-