Class LuceneByteVectorCodec

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

public class LuceneByteVectorCodec extends AbstractLuceneVectorFieldCodec<byte[]>
  • Constructor Details

    • LuceneByteVectorCodec

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

    • decode

      public byte[] 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 byte[] raw(org.apache.lucene.index.IndexableField field)
    • encodedType

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

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

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

      protected org.apache.lucene.index.VectorEncoding vectorEncoding()
      Specified by:
      vectorEncoding in class AbstractLuceneVectorFieldCodec<byte[]>
    • 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)