Class VectorEncoderDecoder

java.lang.Object
org.elasticsearch.index.mapper.vectors.VectorEncoderDecoder

public final class VectorEncoderDecoder extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final byte
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    decodeDenseVector(org.apache.lucene.util.BytesRef vectorBR, float[] vector)
    Decodes a BytesRef into the provided array of floats
    static float
    decodeMagnitude(Version indexVersion, org.apache.lucene.util.BytesRef vectorBR)
    Decodes the last 4 bytes of the encoded vector, which contains the vector magnitude.
    static int
    denseVectorLength(Version indexVersion, org.apache.lucene.util.BytesRef vectorBR)
     
    static float
    getMagnitude(Version indexVersion, org.apache.lucene.util.BytesRef vectorBR)
     

    Methods inherited from class java.lang.Object

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

  • Method Details

    • denseVectorLength

      public static int denseVectorLength(Version indexVersion, org.apache.lucene.util.BytesRef vectorBR)
    • decodeMagnitude

      public static float decodeMagnitude(Version indexVersion, org.apache.lucene.util.BytesRef vectorBR)
      Decodes the last 4 bytes of the encoded vector, which contains the vector magnitude. NOTE: this function can only be called on vectors from an index version greater than or equal to 7.5.0, since vectors created prior to that do not store the magnitude.
    • getMagnitude

      public static float getMagnitude(Version indexVersion, org.apache.lucene.util.BytesRef vectorBR)
    • decodeDenseVector

      public static void decodeDenseVector(org.apache.lucene.util.BytesRef vectorBR, float[] vector)
      Decodes a BytesRef into the provided array of floats
      Parameters:
      vectorBR - - dense vector encoded in BytesRef
      vector - - array of floats where the decoded vector should be stored