Class VectorEncoderDecoder

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

public final class VectorEncoderDecoder extends Object
  • Field Details

  • Method Details

    • denseVectorLength

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

      public static float decodeMagnitude(IndexVersion 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(IndexVersion indexVersion, org.apache.lucene.util.BytesRef vectorBR, float[] decodedVector)
    • decodeDenseVector

      public static void decodeDenseVector(IndexVersion indexVersion, 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