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.BinarizedByteVectorValues
copy()
Creates a new copy of thisKnnVectorValues
.int
Return the dimension of the vectorsint
float[]
float
getCorrectiveTerms
(int targetOrd) Retrieve the corrective terms for the given vector ordinal.int
Returns the vector byte length, defaults to dimension multiplied by float byte sizeabstract VectorScorer
scorer
(float[] query) Return aVectorScorer
for the given query vector.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.index.ByteVectorValues
checkField, fromBytes, getEncoding, scorer
Methods inherited from class org.apache.lucene.index.KnnVectorValues
createDenseIterator, createSparseIterator, fromDISI, getAcceptOrds, iterator, ordToDoc
-
Method Details
-
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
-
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:KnnVectorValues
Returns the vector byte length, defaults to dimension multiplied by float byte size- Overrides:
getVectorByteLength
in classKnnVectorValues
-
scorer
Return aVectorScorer
for the given query vector.- Parameters:
query
- the query vector- Returns:
- a
VectorScorer
instance or null - Throws:
IOException
-
copy
public abstract org.apache.lucene.codecs.lucene102.BinarizedByteVectorValues copy() throws IOExceptionDescription copied from class:KnnVectorValues
Creates 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:
copy
in classByteVectorValues
- Throws:
IOException
-