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 class
Dense 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 ByteBuffer
protected final int
protected final boolean
protected final int
protected int
protected final int
protected final ScalarQuantizer
protected final float[]
protected final VectorSimilarityFunction
protected final int
protected final IndexInput
protected final FlatVectorsScorer
-
Method Summary
Modifier and TypeMethodDescriptionint
Return the dimension of the vectorsfloat
getScoreCorrectionConstant
(int targetOrd) getSlice()
Returns an IndexInput from which to read this instance's values.int
Returns 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) int
size()
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, scorer
Methods inherited from class org.apache.lucene.index.ByteVectorValues
checkField, fromBytes, getEncoding, scorer
Methods 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:
getScalarQuantizer
in classQuantizedByteVectorValues
-
dimension
public int dimension()Description copied from class:KnnVectorValues
Return the dimension of the vectors- Specified by:
dimension
in classKnnVectorValues
-
size
public int size()Description copied from class:KnnVectorValues
Return the number of vectors for this field.- Specified by:
size
in classKnnVectorValues
- Returns:
- the number of vectors returned by this iterator
-
vectorValue
Description copied from class:ByteVectorValues
Return 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:
vectorValue
in classByteVectorValues
- Returns:
- the vector value
- Throws:
IOException
-
getScoreCorrectionConstant
- Specified by:
getScoreCorrectionConstant
in classQuantizedByteVectorValues
- Throws:
IOException
-
getSlice
Description copied from interface:HasIndexSlice
Returns an IndexInput from which to read this instance's values.- Specified by:
getSlice
in interfaceHasIndexSlice
- Overrides:
getSlice
in classQuantizedByteVectorValues
-
getVectorByteLength
public int getVectorByteLength()Description copied from class:KnnVectorValues
Returns the vector byte length, defaults to dimension multiplied by float byte size- Overrides:
getVectorByteLength
in 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
-