Interface VectorScorerFactory


public interface VectorScorerFactory
  • Method Summary

    Modifier and Type
    Method
    Description
    Optional<org.apache.lucene.util.hnsw.RandomVectorScorer>
    getBFloat16VectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.index.FloatVectorValues values, float[] queryVector)
    Returns an optional containing a bfloat16 vector scorer for the given parameters, or an empty optional if a scorer is not supported.
    Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier>
    getBFloat16VectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.index.FloatVectorValues values)
    Returns an optional containing a bfloat16 vector score supplier for the given parameters, or an empty optional if a scorer is not supported.
    Optional<org.apache.lucene.util.hnsw.RandomVectorScorer>
    getFloat32VectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.index.FloatVectorValues values, float[] queryVector)
    Returns an optional containing a float vector scorer for the given parameters, or an empty optional if a scorer is not supported.
    Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier>
    getFloat32VectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.index.FloatVectorValues values)
    Returns an optional containing a float vector score supplier for the given parameters, or an empty optional if a scorer is not supported.
    Optional<org.apache.lucene.util.hnsw.RandomVectorScorer>
    getInt4VectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.util.quantization.QuantizedByteVectorValues values, byte[] unpackedQuery, float lowerInterval, float upperInterval, float additionalCorrection, int quantizedComponentSum)
    Returns an optional containing an int4 packed-nibble query-time vector scorer for the given parameters, or an empty optional if a scorer is not supported.
    Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier>
    getInt4VectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.util.quantization.QuantizedByteVectorValues values)
    Returns an optional containing an int4 packed-nibble vector score supplier for the given parameters, or an empty optional if a scorer is not supported.
    Optional<org.apache.lucene.util.hnsw.RandomVectorScorer>
    getInt7SQVectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.util.quantization.LegacyQuantizedByteVectorValues values, float[] queryVector)
    Returns an optional containing an int7 scalar quantized vector scorer for the given parameters, or an empty optional if a scorer is not supported.
    Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier>
    getInt7SQVectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.util.quantization.LegacyQuantizedByteVectorValues values, float scoreCorrectionConstant)
    Returns an optional containing an int7 scalar quantized vector score supplier for the given parameters, or an empty optional if a scorer is not supported.
    Optional<org.apache.lucene.util.hnsw.RandomVectorScorer>
    getInt7uOSQVectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.util.quantization.QuantizedByteVectorValues values, byte[] quantizedQuery, float lowerInterval, float upperInterval, float additionalCorrection, int quantizedComponentSum)
    Returns an optional containing an int7 optimal scalar quantized vector scorer for the given parameters, or an empty optional if a scorer is not supported.
    Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier>
    getInt7uOSQVectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.util.quantization.QuantizedByteVectorValues values)
    Returns an optional containing an int7 optimal scalar quantized vector score supplier for the given parameters, or an empty optional if a scorer is not supported.
    Optional<org.apache.lucene.util.hnsw.RandomVectorScorer>
    getInt8VectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.index.ByteVectorValues values, byte[] queryVector)
    Returns an optional containing a byte vector scorer for the given parameters, or an empty optional if a scorer is not supported.
    Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier>
    getInt8VectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.index.ByteVectorValues values)
    Returns an optional containing a byte vector score supplier for the given parameters, or an empty optional if a scorer is not supported.
    newES91OSQVectorsScorer(org.apache.lucene.store.IndexInput input, int dimension, int bulkSize)
    Create a new ES91OSQVectorsScorer for the given IndexInput.
    newES92Int7VectorsScorer(org.apache.lucene.store.IndexInput input, int dimension, int bulkSize)
    Create a new ES92Int7VectorsScorer for the given IndexInput.
    newES93BinaryQuantizedVectorScorer(org.apache.lucene.store.IndexInput input, int dimensions, int vectorLengthInBytes)
     
    newES940OSQVectorsScorer(org.apache.lucene.store.IndexInput input, byte queryBits, byte indexBits, int dimension, int dataLength, int bulkSize, ES940OSQVectorsScorer.BitEncoding bitEncoding)
    Create a new ES940OSQVectorsScorer for the given IndexInput and explicit packed-vs-striped disk layout.
    org.apache.lucene.codecs.hnsw.FlatVectorsScorer
    Create a new FlatVectorsScorer for scoring arbitrary flat vectors.
    boolean
    true if this factory uses native code anywhere.
  • Method Details

    • usesNative

      boolean usesNative()
      true if this factory uses native code anywhere.
    • newES91OSQVectorsScorer

      ES91OSQVectorsScorer newES91OSQVectorsScorer(org.apache.lucene.store.IndexInput input, int dimension, int bulkSize) throws IOException
      Create a new ES91OSQVectorsScorer for the given IndexInput.
      Throws:
      IOException
    • newES940OSQVectorsScorer

      ES940OSQVectorsScorer newES940OSQVectorsScorer(org.apache.lucene.store.IndexInput input, byte queryBits, byte indexBits, int dimension, int dataLength, int bulkSize, ES940OSQVectorsScorer.BitEncoding bitEncoding) throws IOException
      Create a new ES940OSQVectorsScorer for the given IndexInput and explicit packed-vs-striped disk layout. The input should be unwrapped before calling this method. If the input is still a FilterIndexInput that does not implement MemorySegmentAccessInput or DirectAccessInput, an IllegalArgumentException is thrown. Non-wrapper inputs (e.g. ByteBuffersIndexInput) are accepted and use a heap-copy fallback.
      Throws:
      IOException
    • newES92Int7VectorsScorer

      ES92Int7VectorsScorer newES92Int7VectorsScorer(org.apache.lucene.store.IndexInput input, int dimension, int bulkSize) throws IOException
      Throws:
      IOException
    • newES93BinaryQuantizedVectorScorer

      ES93BinaryQuantizedVectorScorer newES93BinaryQuantizedVectorScorer(org.apache.lucene.store.IndexInput input, int dimensions, int vectorLengthInBytes) throws IOException
      Throws:
      IOException
    • newFlatVectorsScorer

      org.apache.lucene.codecs.hnsw.FlatVectorsScorer newFlatVectorsScorer()
      Create a new FlatVectorsScorer for scoring arbitrary flat vectors.
    • getFloat32VectorScorerSupplier

      Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getFloat32VectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.index.FloatVectorValues values)
      Returns an optional containing a float vector score supplier for the given parameters, or an empty optional if a scorer is not supported.
      Parameters:
      similarityType - the similarity type
      input - the index input containing the vector data; offset of the first vector is 0, the length must be (maxOrd + Float#BYTES) * dims
      values - the random access vector values
      Returns:
      an optional containing the vector scorer supplier, or empty
    • getBFloat16VectorScorerSupplier

      Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getBFloat16VectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.index.FloatVectorValues values)
      Returns an optional containing a bfloat16 vector score supplier for the given parameters, or an empty optional if a scorer is not supported.
      Parameters:
      similarityType - the similarity type
      input - the index input containing the vector data; offset of the first vector is 0, the length must be (maxOrd) * dims * 2
      values - the random access vector values
      Returns:
      an optional containing the vector scorer supplier, or empty
    • getInt8VectorScorerSupplier

      Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getInt8VectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.index.ByteVectorValues values)
      Returns an optional containing a byte vector score supplier for the given parameters, or an empty optional if a scorer is not supported.
      Parameters:
      similarityType - the similarity type
      input - the index input containing the vector data; offset of the first vector is 0, the length must be (maxOrd) * dims
      values - the random access vector values
      Returns:
      an optional containing the vector scorer supplier, or empty
    • getFloat32VectorScorer

      Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getFloat32VectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.index.FloatVectorValues values, float[] queryVector)
      Returns an optional containing a float vector scorer for the given parameters, or an empty optional if a scorer is not supported.
      Parameters:
      sim - the similarity type
      values - the random access vector values
      queryVector - the query vector
      Returns:
      an optional containing the vector scorer, or empty
    • getBFloat16VectorScorer

      Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getBFloat16VectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.index.FloatVectorValues values, float[] queryVector)
      Returns an optional containing a bfloat16 vector scorer for the given parameters, or an empty optional if a scorer is not supported.
      Parameters:
      sim - the similarity type
      values - the random access vector values
      queryVector - the query vector
      Returns:
      an optional containing the vector scorer, or empty
    • getInt8VectorScorer

      Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getInt8VectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.index.ByteVectorValues values, byte[] queryVector)
      Returns an optional containing a byte vector scorer for the given parameters, or an empty optional if a scorer is not supported.
      Parameters:
      sim - the similarity type
      values - the random access vector values
      queryVector - the query vector
      Returns:
      an optional containing the vector scorer, or empty
    • getInt7SQVectorScorerSupplier

      Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getInt7SQVectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.util.quantization.LegacyQuantizedByteVectorValues values, float scoreCorrectionConstant)
      Returns an optional containing an int7 scalar quantized vector score supplier for the given parameters, or an empty optional if a scorer is not supported.
      Parameters:
      similarityType - the similarity type
      input - the index input containing the vector data; offset of the first vector is 0, the length must be (maxOrd + Float#BYTES) * dims
      values - the random access vector values
      scoreCorrectionConstant - the score correction constant
      Returns:
      an optional containing the vector scorer supplier, or empty
    • getInt7SQVectorScorer

      Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getInt7SQVectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.util.quantization.LegacyQuantizedByteVectorValues values, float[] queryVector)
      Returns an optional containing an int7 scalar quantized vector scorer for the given parameters, or an empty optional if a scorer is not supported.
      Parameters:
      sim - the similarity type
      values - the random access vector values
      queryVector - the query vector
      Returns:
      an optional containing the vector scorer, or empty
    • getInt7uOSQVectorScorerSupplier

      Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getInt7uOSQVectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.util.quantization.QuantizedByteVectorValues values)
      Returns an optional containing an int7 optimal scalar quantized vector score supplier for the given parameters, or an empty optional if a scorer is not supported.
      Parameters:
      similarityType - the similarity type
      input - the index input containing the vector data
      values - the random access vector values
      Returns:
      an optional containing the vector scorer supplier, or empty
    • getInt7uOSQVectorScorer

      Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getInt7uOSQVectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.util.quantization.QuantizedByteVectorValues values, byte[] quantizedQuery, float lowerInterval, float upperInterval, float additionalCorrection, int quantizedComponentSum)
      Returns an optional containing an int7 optimal scalar quantized vector scorer for the given parameters, or an empty optional if a scorer is not supported.
      Parameters:
      sim - the similarity type
      values - the random access vector values
      Returns:
      an optional containing the vector scorer, or empty
    • getInt4VectorScorerSupplier

      Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getInt4VectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.util.quantization.QuantizedByteVectorValues values)
      Returns an optional containing an int4 packed-nibble vector score supplier for the given parameters, or an empty optional if a scorer is not supported.
      Parameters:
      similarityType - the similarity type
      input - the index input containing the vector data
      values - the random access vector values
      Returns:
      an optional containing the vector scorer supplier, or empty
    • getInt4VectorScorer

      Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getInt4VectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.util.quantization.QuantizedByteVectorValues values, byte[] unpackedQuery, float lowerInterval, float upperInterval, float additionalCorrection, int quantizedComponentSum)
      Returns an optional containing an int4 packed-nibble query-time vector scorer for the given parameters, or an empty optional if a scorer is not supported.
      Parameters:
      sim - the similarity function
      values - the quantized vector values
      unpackedQuery - the quantized query bytes (one byte per dimension, 0-15)
      lowerInterval - query corrective term
      upperInterval - query corrective term
      additionalCorrection - query corrective term
      quantizedComponentSum - query corrective term
      Returns:
      an optional containing the vector scorer, or empty