Module org.elasticsearch.server
Class VectorEncoderDecoder
java.lang.Object
org.elasticsearch.index.mapper.vectors.VectorEncoderDecoder
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic void
decodeDenseVector
(IndexVersion indexVersion, org.apache.lucene.util.BytesRef vectorBR, float[] vector) Decodes a BytesRef into the provided array of floatsstatic float
decodeMagnitude
(IndexVersion indexVersion, org.apache.lucene.util.BytesRef vectorBR) Decodes the last 4 bytes of the encoded vector, which contains the vector magnitude.static int
denseVectorLength
(IndexVersion indexVersion, org.apache.lucene.util.BytesRef vectorBR) static float
getMagnitude
(IndexVersion indexVersion, org.apache.lucene.util.BytesRef vectorBR, float[] decodedVector)
-
Field Details
-
INT_BYTES
public static final byte INT_BYTES- See Also:
-
-
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 BytesRefvector
- - array of floats where the decoded vector should be stored
-