Package org.apache.lucene.codecs.lucene102

# Class OffHeapBinarizedVectorValues

java.lang.Object
org.apache.lucene.index.KnnVectorValues
org.apache.lucene.index.ByteVectorValues
org.apache.lucene.codecs.lucene102.OffHeapBinarizedVectorValues

public abstract class OffHeapBinarizedVectorValues extends ByteVectorValues
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 Type
  Method
  Description
  `abstract org.apache.lucene.codecs.lucene102.BinarizedByteVectorValues`
  `copy()`
  Creates a new copy of this `KnnVectorValues`.
  `int`
  `dimension()`
  Return the dimension of the vectors
  `int`
  `discretizedDimensions()`
  `float[]`
  `getCentroid()`
  `float`
  `getCentroidDP()`
  `OptimizedScalarQuantizer.QuantizationResult`
  `getCorrectiveTerms(int targetOrd)`
  Retrieve the corrective terms for the given vector ordinal.
  `OptimizedScalarQuantizer`
  `getQuantizer()`
  `int`
  `getVectorByteLength()`
  Returns the vector byte length, defaults to dimension multiplied by float byte size
  `abstract VectorScorer`
  `scorer(float[] query)`
  Return a `VectorScorer` 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`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### dimension

    public int dimension()
    Description copied from class: `KnnVectorValues`
    Return the dimension of the vectors
    Specified by:
      `dimension` in class `KnnVectorValues`

  - ### size

    public int size()
    Description copied from class: `KnnVectorValues`
    Return the number of vectors for this field.
    Specified by:
      `size` in class `KnnVectorValues`
    Returns:
      the number of vectors returned by this iterator

  - ### vectorValue

    public byte[] vectorValue(int targetOrd) throws IOException
    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 class `ByteVectorValues`
    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
    For euclidean:
    - 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

    public OptimizedScalarQuantizer 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 class `KnnVectorValues`

  - ### scorer

    public abstract VectorScorer scorer(float[] query) throws IOException
    Return a `VectorScorer` 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 IOException
    Description copied from class: `KnnVectorValues`
    Creates a new copy of this `KnnVectorValues`. This is helpful when you need to access different values at once, to avoid overwriting the underlying vector returned.
    Specified by:
      `copy` in class `ByteVectorValues`
    Throws:
      `IOException`