Class OffHeapBinarizedVectorValues
java.lang.Object
org.apache.lucene.index.KnnVectorValues
org.apache.lucene.index.ByteVectorValues
org.apache.lucene.codecs.lucene102.OffHeapBinarizedVectorValues
Binarized vector values loaded from off-heap
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.index.KnnVectorValues
KnnVectorValues.DocIndexIterator -
Method Summary
Modifier and TypeMethodDescriptionabstract org.apache.lucene.codecs.lucene102.BinarizedByteVectorValuescopy()Creates a new copy of thisKnnVectorValues.intReturn the dimension of the vectorsintfloat[]floatgetCorrectiveTerms(int targetOrd) Retrieve the corrective terms for the given vector ordinal.intReturns the vector byte length, defaults to dimension multiplied by float byte sizeabstract VectorScorerscorer(float[] query) Return aVectorScorerfor the given query vector.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.index.ByteVectorValues
checkField, fromBytes, getEncoding, scorerMethods inherited from class org.apache.lucene.index.KnnVectorValues
createDenseIterator, createSparseIterator, fromDISI, getAcceptOrds, iterator, ordToDoc
-
Method Details
-
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
-
discretizedDimensions
public int discretizedDimensions() -
getCentroidDP
public float getCentroidDP() -
getCorrectiveTerms
public OptimizedScalarQuantizer.QuantizationResult getCorrectiveTerms(int targetOrd) throws IOException Retrieve the corrective terms for the given vector ordinal. For the dot-product family of distances, the corrective terms are, in order- the lower optimized interval
- the upper optimized interval
- the dot-product of the non-centered vector with the centroid
- the sum of quantized components
- the lower optimized interval
- the upper optimized interval
- the l2norm of the centered vector
- the sum of quantized components
- Parameters:
targetOrd- the vector ordinal- Returns:
- the corrective terms
- Throws:
IOException- if an I/O error occurs
-
getQuantizer
- Returns:
- the quantizer used to quantize the vectors
-
getCentroid
public float[] getCentroid() -
getVectorByteLength
public int getVectorByteLength()Description copied from class:KnnVectorValuesReturns the vector byte length, defaults to dimension multiplied by float byte size- Overrides:
getVectorByteLengthin classKnnVectorValues
-
scorer
Return aVectorScorerfor the given query vector.- Parameters:
query- the query vector- Returns:
- a
VectorScorerinstance or null - Throws:
IOException
-
copy
public abstract org.apache.lucene.codecs.lucene102.BinarizedByteVectorValues copy() throws IOExceptionDescription copied from class:KnnVectorValuesCreates a new copy of thisKnnVectorValues. This is helpful when you need to access different values at once, to avoid overwriting the underlying vector returned.- Specified by:
copyin classByteVectorValues- Throws:
IOException
-