# Uses of Enum Class
org.apache.lucene.index.VectorSimilarityFunction

Packages that use VectorSimilarityFunction
Package
Description
org.apache.lucene.codecs.hnsw
HNSW vector helper classes.
org.apache.lucene.codecs.lucene95
Lucene 9.5 file format.
org.apache.lucene.codecs.lucene99
Lucene 9.9 file format.
org.apache.lucene.document
The logical representation of a `Document` for indexing and searching.
org.apache.lucene.index
Code to maintain and access indices.
org.apache.lucene.util.quantization
Provides quantization methods for scaling vector values to smaller data types and possibly fewer dimensions

## Uses of VectorSimilarityFunction in org.apache.lucene.codecs.hnsw

Methods in org.apache.lucene.codecs.hnsw with parameters of type VectorSimilarityFunction
Modifier and Type
Method
Description
`RandomVectorScorer`
DefaultFlatVectorScorer.`getRandomVectorScorer(VectorSimilarityFunction similarityFunction, KnnVectorValues vectorValues, byte[] target)`
`RandomVectorScorer`
DefaultFlatVectorScorer.`getRandomVectorScorer(VectorSimilarityFunction similarityFunction, KnnVectorValues vectorValues, float[] target)`
`RandomVectorScorer`
FlatVectorsScorer.`getRandomVectorScorer(VectorSimilarityFunction similarityFunction, KnnVectorValues vectorValues, byte[] target)`
Returns a `RandomVectorScorer` for the given set of vectors and target vector.
`RandomVectorScorer`
FlatVectorsScorer.`getRandomVectorScorer(VectorSimilarityFunction similarityFunction, KnnVectorValues vectorValues, float[] target)`
Returns a `RandomVectorScorer` for the given set of vectors and target vector.
`RandomVectorScorer`
ScalarQuantizedVectorScorer.`getRandomVectorScorer(VectorSimilarityFunction similarityFunction, KnnVectorValues vectorValues, byte[] target)`
`RandomVectorScorer`
ScalarQuantizedVectorScorer.`getRandomVectorScorer(VectorSimilarityFunction similarityFunction, KnnVectorValues vectorValues, float[] target)`
`RandomVectorScorerSupplier`
DefaultFlatVectorScorer.`getRandomVectorScorerSupplier(VectorSimilarityFunction similarityFunction, KnnVectorValues vectorValues)`
`RandomVectorScorerSupplier`
FlatVectorsScorer.`getRandomVectorScorerSupplier(VectorSimilarityFunction similarityFunction, KnnVectorValues vectorValues)`
Returns a `RandomVectorScorerSupplier` that can be used to score vectors
`RandomVectorScorerSupplier`
ScalarQuantizedVectorScorer.`getRandomVectorScorerSupplier(VectorSimilarityFunction similarityFunction, KnnVectorValues vectorValues)`
`static float`
ScalarQuantizedVectorScorer.`quantizeQuery(float[] query, byte[] quantizedQuery, VectorSimilarityFunction similarityFunction, ScalarQuantizer scalarQuantizer)`
Constructors in org.apache.lucene.codecs.hnsw with parameters of type VectorSimilarityFunction
Modifier
Constructor
Description
``
`ScalarQuantizedRandomVectorScorerSupplier(VectorSimilarityFunction similarityFunction, ScalarQuantizer scalarQuantizer, QuantizedByteVectorValues values)`

## Uses of VectorSimilarityFunction in org.apache.lucene.codecs.lucene95

Fields in org.apache.lucene.codecs.lucene95 declared as VectorSimilarityFunction
Modifier and Type
Field
Description
`protected final VectorSimilarityFunction`
OffHeapByteVectorValues.`similarityFunction`
`protected final VectorSimilarityFunction`
OffHeapFloatVectorValues.`similarityFunction`
Methods in org.apache.lucene.codecs.lucene95 with parameters of type VectorSimilarityFunction
Modifier and Type
Method
Description
`static OffHeapByteVectorValues`
OffHeapByteVectorValues.`load(VectorSimilarityFunction vectorSimilarityFunction, FlatVectorsScorer flatVectorsScorer, OrdToDocDISIReaderConfiguration configuration, VectorEncoding vectorEncoding, int dimension, long vectorDataOffset, long vectorDataLength, IndexInput vectorData)`
`static OffHeapFloatVectorValues`
OffHeapFloatVectorValues.`load(VectorSimilarityFunction vectorSimilarityFunction, FlatVectorsScorer flatVectorsScorer, OrdToDocDISIReaderConfiguration configuration, VectorEncoding vectorEncoding, int dimension, long vectorDataOffset, long vectorDataLength, IndexInput vectorData)`
Constructors in org.apache.lucene.codecs.lucene95 with parameters of type VectorSimilarityFunction
Modifier
Constructor
Description
``
`DenseOffHeapVectorValues(int dimension, int size, IndexInput slice, int byteSize, FlatVectorsScorer flatVectorsScorer, VectorSimilarityFunction vectorSimilarityFunction)`
``
`DenseOffHeapVectorValues(int dimension, int size, IndexInput slice, int byteSize, FlatVectorsScorer flatVectorsScorer, VectorSimilarityFunction similarityFunction)`

## Uses of VectorSimilarityFunction in org.apache.lucene.codecs.lucene99

Fields in org.apache.lucene.codecs.lucene99 declared as VectorSimilarityFunction
Modifier and Type
Field
Description
`protected final VectorSimilarityFunction`
OffHeapQuantizedByteVectorValues.`similarityFunction`
Fields in org.apache.lucene.codecs.lucene99 with type parameters of type VectorSimilarityFunction
Modifier and Type
Field
Description
`static final List<VectorSimilarityFunction>`
Lucene99HnswVectorsReader.`SIMILARITY_FUNCTIONS`
Methods in org.apache.lucene.codecs.lucene99 that return VectorSimilarityFunction
Modifier and Type
Method
Description
`static VectorSimilarityFunction`
Lucene99HnswVectorsReader.`readSimilarityFunction(DataInput input)`
Methods in org.apache.lucene.codecs.lucene99 with parameters of type VectorSimilarityFunction
Modifier and Type
Method
Description
`RandomVectorScorer`
Lucene99ScalarQuantizedVectorScorer.`getRandomVectorScorer(VectorSimilarityFunction similarityFunction, KnnVectorValues vectorValues, byte[] target)`
`RandomVectorScorer`
Lucene99ScalarQuantizedVectorScorer.`getRandomVectorScorer(VectorSimilarityFunction similarityFunction, KnnVectorValues vectorValues, float[] target)`
`RandomVectorScorerSupplier`
Lucene99ScalarQuantizedVectorScorer.`getRandomVectorScorerSupplier(VectorSimilarityFunction similarityFunction, KnnVectorValues vectorValues)`
`static OffHeapQuantizedByteVectorValues`
OffHeapQuantizedByteVectorValues.`load(OrdToDocDISIReaderConfiguration configuration, int dimension, int size, ScalarQuantizer scalarQuantizer, VectorSimilarityFunction similarityFunction, FlatVectorsScorer vectorsScorer, boolean compress, long quantizedVectorDataOffset, long quantizedVectorDataLength, IndexInput vectorData)`
Constructors in org.apache.lucene.codecs.lucene99 with parameters of type VectorSimilarityFunction
Modifier
Constructor
Description
``
`DenseOffHeapVectorValues(int dimension, int size, ScalarQuantizer scalarQuantizer, boolean compress, VectorSimilarityFunction similarityFunction, FlatVectorsScorer vectorsScorer, IndexInput slice)`

## Uses of VectorSimilarityFunction in org.apache.lucene.document

Methods in org.apache.lucene.document that return VectorSimilarityFunction
Modifier and Type
Method
Description
`VectorSimilarityFunction`
FieldType.`vectorSimilarityFunction()`
Methods in org.apache.lucene.document with parameters of type VectorSimilarityFunction
Modifier and Type
Method
Description
`static FieldType`
KnnByteVectorField.`createFieldType(int dimension, VectorSimilarityFunction similarityFunction)`
A convenience method for creating a vector field type.
`static FieldType`
KnnFloatVectorField.`createFieldType(int dimension, VectorSimilarityFunction similarityFunction)`
A convenience method for creating a vector field type.
`void`
FieldType.`setVectorAttributes(int numDimensions, VectorEncoding encoding, VectorSimilarityFunction similarity)`
Enable vector indexing, with the specified number of dimensions and distance function.
Constructors in org.apache.lucene.document with parameters of type VectorSimilarityFunction
Modifier
Constructor
Description
``
`KnnByteVectorField(String name, byte[] vector, VectorSimilarityFunction similarityFunction)`
Creates a numeric vector field.
``
`KnnFloatVectorField(String name, float[] vector, VectorSimilarityFunction similarityFunction)`
Creates a numeric vector field.

## Uses of VectorSimilarityFunction in org.apache.lucene.index

Methods in org.apache.lucene.index that return VectorSimilarityFunction
Modifier and Type
Method
Description
`VectorSimilarityFunction`
FieldInfo.`getVectorSimilarityFunction()`
Returns `VectorSimilarityFunction` for the field
`static VectorSimilarityFunction`
VectorSimilarityFunction.`valueOf(String name)`
Returns the enum constant of this class with the specified name.
`static VectorSimilarityFunction[]`
VectorSimilarityFunction.`values()`
Returns an array containing the constants of this enum class, in the order they are declared.
`VectorSimilarityFunction`
IndexableFieldType.`vectorSimilarityFunction()`
The `VectorSimilarityFunction` of the field's vector value
Constructors in org.apache.lucene.index with parameters of type VectorSimilarityFunction
Modifier
Constructor
Description
``
`FieldInfo(String name, int number, boolean storeTermVector, boolean omitNorms, boolean storePayloads, IndexOptions indexOptions, DocValuesType docValues, DocValuesSkipIndexType docValuesSkipIndex, long dvGen, Map<String,String> attributes, int pointDimensionCount, int pointIndexDimensionCount, int pointNumBytes, int vectorDimension, VectorEncoding vectorEncoding, VectorSimilarityFunction vectorSimilarityFunction, boolean softDeletesField, boolean isParentField)`
Sole constructor.

## Uses of VectorSimilarityFunction in org.apache.lucene.util.quantization

Methods in org.apache.lucene.util.quantization with parameters of type VectorSimilarityFunction
Modifier and Type
Method
Description
`static ScalarQuantizer`
ScalarQuantizer.`fromVectorsAutoInterval(FloatVectorValues floatVectorValues, VectorSimilarityFunction function, int totalVectorCount, byte bits)`
`static ScalarQuantizedVectorSimilarity`
ScalarQuantizedVectorSimilarity.`fromVectorSimilarity(VectorSimilarityFunction sim, float constMultiplier, byte bits)`
Creates a `ScalarQuantizedVectorSimilarity` from a `VectorSimilarityFunction` and the constant multiplier used for quantization.
`float`
ScalarQuantizer.`quantize(float[] src, byte[] dest, VectorSimilarityFunction similarityFunction)`
Quantize a float vector into a byte vector
`float`
ScalarQuantizer.`recalculateCorrectiveOffset(byte[] quantizedVector, ScalarQuantizer oldQuantizer, VectorSimilarityFunction similarityFunction)`
Recalculate the old score corrective value given new current quantiles