Class LuceneFloatVectorCodec

java.lang.Object
org.hibernate.search.backend.lucene.types.codec.impl.AbstractLuceneVectorFieldCodec<float[]>
org.hibernate.search.backend.lucene.types.codec.impl.LuceneFloatVectorCodec
All Implemented Interfaces:
LuceneFieldCodec<float[],float[]>, LuceneVectorFieldCodec<float[]>

public class LuceneFloatVectorCodec extends AbstractLuceneVectorFieldCodec<float[]>
  • Constructor Details

    • LuceneFloatVectorCodec

      public LuceneFloatVectorCodec(org.apache.lucene.index.VectorSimilarityFunction vectorSimilarity, int dimension, Storage storage, Indexing indexing, float[] indexNullAsValue, HibernateSearchKnnVectorsFormat knnVectorsFormat)
  • Method Details

    • decode

      public float[] decode(org.apache.lucene.index.IndexableField field)
      Description copied from interface: LuceneFieldCodec
      Extract the value from the given stored field.

      Typically used in projections.

      Parameters:
      field - The document field. Never null.
      Returns:
      The decoded value.
    • raw

      public float[] raw(org.apache.lucene.index.IndexableField field)
    • encodedType

      public Class<float[]> encodedType()
      Returns:
      The type of the encoded value.
    • toByteArray

      protected byte[] toByteArray(float[] value)
      Specified by:
      toByteArray in class AbstractLuceneVectorFieldCodec<float[]>
    • createIndexField

      protected org.apache.lucene.index.IndexableField createIndexField(String absoluteFieldPath, float[] value)
      Specified by:
      createIndexField in class AbstractLuceneVectorFieldCodec<float[]>
    • vectorEncoding

      protected org.apache.lucene.index.VectorEncoding vectorEncoding()
      Specified by:
      vectorEncoding in class AbstractLuceneVectorFieldCodec<float[]>
    • vectorElementsType

      public Class<?> vectorElementsType()
      Returns:
      The type of vector elements expected to get either float.class or byte.class.
    • similarityDistanceToScore

      public float similarityDistanceToScore(float distance)