Interface LuceneFieldCodec<F,E>
- Type Parameters:
F- The field type as declared onE- The encoded type. For example, for aLocalDatefield this will beLong.
- All Known Subinterfaces:
LuceneVectorFieldCodec<F>
- All Known Implementing Classes:
AbstractLuceneNumericFieldCodec,AbstractLuceneVectorFieldCodec,LuceneBigDecimalFieldCodec,LuceneBigIntegerFieldCodec,LuceneBooleanFieldCodec,LuceneByteFieldCodec,LuceneByteVectorCodec,LuceneDoubleFieldCodec,LuceneFieldFieldCodec,LuceneFloatFieldCodec,LuceneFloatVectorCodec,LuceneGeoPointFieldCodec,LuceneInstantFieldCodec,LuceneIntegerFieldCodec,LuceneLocalDateFieldCodec,LuceneLocalDateTimeFieldCodec,LuceneLocalTimeFieldCodec,LuceneLongFieldCodec,LuceneMonthDayFieldCodec,LuceneOffsetDateTimeFieldCodec,LuceneOffsetTimeFieldCodec,LuceneShortFieldCodec,LuceneStringFieldCodec,LuceneYearFieldCodec,LuceneYearMonthFieldCodec,LuceneZonedDateTimeFieldCodec
public interface LuceneFieldCodec<F,E>
Defines how a given value will be encoded in the Lucene document and how it will be decoded.
Encodes values received from an IndexFieldReference when indexing,
and returns decoded values to the hit extractor when projecting in a search query.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddToDocument(LuceneDocumentContent documentBuilder, String absoluteFieldPath, F value) Encode the given value in the document by adding new fields to the Lucene document.decode(org.apache.lucene.index.IndexableField field) Extract the value from the given stored field.Encode the given value.booleanisCompatibleWith(LuceneFieldCodec<?, ?> other) Determine whether the given codec provides an encoding that is compatible with this codec, i.e. whether itsdecode(IndexableField)andencode(Object)methods behave the same way.raw(org.apache.lucene.index.IndexableField field)
-
Method Details
-
addToDocument
Encode the given value in the document by adding new fields to the Lucene document.- Parameters:
documentBuilder- The document builder.absoluteFieldPath- The absolute path of the field.value- The value to encode.
-
decode
Extract the value from the given stored field.Typically used in projections.
- Parameters:
field- The document field. Nevernull.- Returns:
- The decoded value.
-
raw
-
decode
-
encode
Encode the given value.Useful for predicates and sorts in particular.
- Parameters:
value- The value to encode.
-
encodedType
- Returns:
- The type of the encoded value.
-
isCompatibleWith
Determine whether the given codec provides an encoding that is compatible with this codec, i.e. whether itsdecode(IndexableField)andencode(Object)methods behave the same way.NOTE:
addToDocument(LuceneDocumentContent, String, Object)may behave differently, e.g. it may add docvalues while this codec does not. The behavior ofaddToDocument(LuceneDocumentContent, String, Object)is considered irrelevant when checking the equivalence of encoding, because such differences should be accounted for through other ways (fields being assigned incompatible predicate factories, etc.).- Parameters:
other- AnotherLuceneFieldCodec, nevernull.- Returns:
trueif the given codec is compatible.falseotherwise, or when in doubt.
-