Module org.apache.lucene.core
Class Lucene99ScalarQuantizedVectorScorer
- java.lang.Object
-
- org.apache.lucene.codecs.lucene99.Lucene99ScalarQuantizedVectorScorer
-
- All Implemented Interfaces:
FlatVectorsScorer
public class Lucene99ScalarQuantizedVectorScorer extends java.lang.Object implements FlatVectorsScorer
Optimized scalar quantized implementation ofFlatVectorsScorer
for quantized vectors stored in the Lucene99 format.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
Lucene99ScalarQuantizedVectorScorer.CompressedInt4DotProduct
private static class
Lucene99ScalarQuantizedVectorScorer.DotProduct
Calculates dot product on quantized vectors, applying the appropriate correctionsprivate static class
Lucene99ScalarQuantizedVectorScorer.Euclidean
private static interface
Lucene99ScalarQuantizedVectorScorer.FloatToFloatFunction
private static class
Lucene99ScalarQuantizedVectorScorer.Int4DotProduct
private static class
Lucene99ScalarQuantizedVectorScorer.ScalarQuantizedRandomVectorScorerSupplier
-
Field Summary
Fields Modifier and Type Field Description private FlatVectorsScorer
nonQuantizedDelegate
-
Constructor Summary
Constructors Constructor Description Lucene99ScalarQuantizedVectorScorer(FlatVectorsScorer flatVectorsScorer)
-
Method Summary
-
-
-
Field Detail
-
nonQuantizedDelegate
private final FlatVectorsScorer nonQuantizedDelegate
-
-
Constructor Detail
-
Lucene99ScalarQuantizedVectorScorer
public Lucene99ScalarQuantizedVectorScorer(FlatVectorsScorer flatVectorsScorer)
-
-
Method Detail
-
getRandomVectorScorerSupplier
public RandomVectorScorerSupplier getRandomVectorScorerSupplier(VectorSimilarityFunction similarityFunction, RandomAccessVectorValues vectorValues) throws java.io.IOException
Description copied from interface:FlatVectorsScorer
Returns aRandomVectorScorerSupplier
that can be used to score vectors- Specified by:
getRandomVectorScorerSupplier
in interfaceFlatVectorsScorer
- Parameters:
similarityFunction
- the similarity function to usevectorValues
- the vector values to score- Returns:
- a
RandomVectorScorerSupplier
that can be used to score vectors - Throws:
java.io.IOException
- if an I/O error occurs
-
getRandomVectorScorer
public RandomVectorScorer getRandomVectorScorer(VectorSimilarityFunction similarityFunction, RandomAccessVectorValues vectorValues, float[] target) throws java.io.IOException
Description copied from interface:FlatVectorsScorer
Returns aRandomVectorScorer
for the given set of vectors and target vector.- Specified by:
getRandomVectorScorer
in interfaceFlatVectorsScorer
- Parameters:
similarityFunction
- the similarity function to usevectorValues
- the vector values to scoretarget
- the target vector- Returns:
- a
RandomVectorScorer
for the given field and target vector. - Throws:
java.io.IOException
- if an I/O error occurs when reading from the index.
-
getRandomVectorScorer
public RandomVectorScorer getRandomVectorScorer(VectorSimilarityFunction similarityFunction, RandomAccessVectorValues vectorValues, byte[] target) throws java.io.IOException
Description copied from interface:FlatVectorsScorer
Returns aRandomVectorScorer
for the given set of vectors and target vector.- Specified by:
getRandomVectorScorer
in interfaceFlatVectorsScorer
- Parameters:
similarityFunction
- the similarity function to usevectorValues
- the vector values to scoretarget
- the target vector- Returns:
- a
RandomVectorScorer
for the given field and target vector. - Throws:
java.io.IOException
- if an I/O error occurs when reading from the index.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
fromVectorSimilarity
static RandomVectorScorer fromVectorSimilarity(byte[] targetBytes, float offsetCorrection, VectorSimilarityFunction sim, float constMultiplier, RandomAccessQuantizedByteVectorValues values)
-
dotProductFactory
private static RandomVectorScorer.AbstractRandomVectorScorer dotProductFactory(byte[] targetBytes, float offsetCorrection, float constMultiplier, RandomAccessQuantizedByteVectorValues values, Lucene99ScalarQuantizedVectorScorer.FloatToFloatFunction scoreAdjustmentFunction)
-
-