Class Int4VectorScorer

java.lang.Object
org.apache.lucene.util.hnsw.RandomVectorScorer.AbstractRandomVectorScorer
org.elasticsearch.simdvec.internal.Int4VectorScorer
All Implemented Interfaces:
org.apache.lucene.util.hnsw.HasKnnVectorValues, org.apache.lucene.util.hnsw.RandomVectorScorer

public final class Int4VectorScorer extends org.apache.lucene.util.hnsw.RandomVectorScorer.AbstractRandomVectorScorer
Int4 packed-nibble query-time scorer. The float query is quantized externally and passed in as unpacked bytes (one byte per dimension, 0-15 range) along with corrective terms. Each stored vector is dims/2 packed bytes followed by corrective terms (3 floats + 1 int).
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.lucene.util.hnsw.RandomVectorScorer

    org.apache.lucene.util.hnsw.RandomVectorScorer.AbstractRandomVectorScorer
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    bulkScore(int[] ordinals, float[] scores, int numNodes)
     
    static Optional<org.apache.lucene.util.hnsw.RandomVectorScorer>
    create(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.codecs.lucene104.QuantizedByteVectorValues values, byte[] unpackedQuery, float lowerInterval, float upperInterval, float additionalCorrection, int quantizedComponentSum)
    Creates an int4 query-time scorer if the input supports efficient access.
    float
    score(int node)
     

    Methods inherited from class org.apache.lucene.util.hnsw.RandomVectorScorer.AbstractRandomVectorScorer

    getAcceptOrds, maxOrd, ordToDoc, values

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • create

      public static Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> create(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.codecs.lucene104.QuantizedByteVectorValues values, byte[] unpackedQuery, float lowerInterval, float upperInterval, float additionalCorrection, int quantizedComponentSum)
      Creates an int4 query-time scorer if the input supports efficient access.
      Parameters:
      sim - the similarity function
      values - the quantized vector values
      unpackedQuery - the quantized query (dims bytes, one per dimension, 0-15)
      lowerInterval - query corrective term
      upperInterval - query corrective term
      additionalCorrection - query corrective term
      quantizedComponentSum - query corrective term
      Returns:
      an optional scorer or empty if the input doesn't support native access
    • score

      public float score(int node) throws IOException
      Throws:
      IOException
    • bulkScore

      public float bulkScore(int[] ordinals, float[] scores, int numNodes) throws IOException
      Throws:
      IOException