Class DenormalizedCosineFloatVectorValues

java.lang.Object
org.apache.lucene.index.KnnVectorValues
org.apache.lucene.index.FloatVectorValues
org.elasticsearch.index.mapper.vectors.DenormalizedCosineFloatVectorValues

public class DenormalizedCosineFloatVectorValues extends org.apache.lucene.index.FloatVectorValues
Provides the denormalized vectors. Float vectors stored with cosine similarity are normalized by default. So when reading the value for scripts, we to denormalize them.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.lucene.index.KnnVectorValues

    org.apache.lucene.index.KnnVectorValues.DocIndexIterator
  • Constructor Summary

    Constructors
    Constructor
    Description
    DenormalizedCosineFloatVectorValues(org.apache.lucene.index.FloatVectorValues in, org.apache.lucene.index.NumericDocValues magnitudeIn)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.lucene.index.FloatVectorValues
     
    int
     
    org.apache.lucene.index.KnnVectorValues.DocIndexIterator
     
    float
     
    org.apache.lucene.search.VectorScorer
    scorer(float[] floats)
     
    int
     
    float[]
    vectorValue(int ord)
     

    Methods inherited from class org.apache.lucene.index.FloatVectorValues

    checkField, fromFloats, getEncoding

    Methods inherited from class org.apache.lucene.index.KnnVectorValues

    createDenseIterator, createSparseIterator, fromDISI, getAcceptOrds, getVectorByteLength, ordToDoc

    Methods inherited from class java.lang.Object

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

    • DenormalizedCosineFloatVectorValues

      public DenormalizedCosineFloatVectorValues(org.apache.lucene.index.FloatVectorValues in, org.apache.lucene.index.NumericDocValues magnitudeIn)
  • Method Details

    • dimension

      public int dimension()
      Specified by:
      dimension in class org.apache.lucene.index.KnnVectorValues
    • size

      public int size()
      Specified by:
      size in class org.apache.lucene.index.KnnVectorValues
    • iterator

      public org.apache.lucene.index.KnnVectorValues.DocIndexIterator iterator()
      Overrides:
      iterator in class org.apache.lucene.index.KnnVectorValues
    • copy

      public org.apache.lucene.index.FloatVectorValues copy() throws IOException
      Specified by:
      copy in class org.apache.lucene.index.FloatVectorValues
      Throws:
      IOException
    • scorer

      public org.apache.lucene.search.VectorScorer scorer(float[] floats) throws IOException
      Overrides:
      scorer in class org.apache.lucene.index.FloatVectorValues
      Throws:
      IOException
    • magnitude

      public float magnitude()
    • vectorValue

      public float[] vectorValue(int ord) throws IOException
      Specified by:
      vectorValue in class org.apache.lucene.index.FloatVectorValues
      Throws:
      IOException