Class QuantizedByteVectorValues

java.lang.Object
org.apache.lucene.index.KnnVectorValues
org.apache.lucene.index.ByteVectorValues
org.apache.lucene.codecs.lucene104.QuantizedByteVectorValues
All Implemented Interfaces:
HasIndexSlice
Direct Known Subclasses:
OffHeapScalarQuantizedVectorValues

public abstract class QuantizedByteVectorValues extends ByteVectorValues implements HasIndexSlice
Scalar quantized byte vector values
  • Constructor Details

    • QuantizedByteVectorValues

      public QuantizedByteVectorValues()
  • Method Details

    • getCorrectiveTerms

      public abstract OptimizedScalarQuantizer.QuantizationResult getCorrectiveTerms(int vectorOrd) 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:
      vectorOrd - the vector ordinal
      Returns:
      the corrective terms
      Throws:
      IOException - if an I/O error occurs
    • getQuantizer

      public abstract OptimizedScalarQuantizer getQuantizer()
      Returns:
      the quantizer used to quantize the vectors
    • getScalarEncoding

      public abstract Lucene104ScalarQuantizedVectorsFormat.ScalarEncoding getScalarEncoding()
      Returns:
      the scalar encoding used to pack the stored vectors.
    • getCentroid

      public abstract float[] getCentroid() throws IOException
      Returns:
      the centroid used to center the vectors prior to quantization
      Throws:
      IOException
    • getCentroidDP

      public abstract float getCentroidDP() throws IOException
      Returns:
      the dot product of the centroid.
      Throws:
      IOException
    • 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 QuantizedByteVectorValues 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
    • getSlice

      public IndexInput getSlice()
      Description copied from interface: HasIndexSlice
      Returns an IndexInput from which to read this instance's values, or null if not available.
      Specified by:
      getSlice in interface HasIndexSlice