Interface LuceneFieldCodec<F>
-
- Type Parameters:
F- The field type as declared on
- All Known Subinterfaces:
LuceneStandardFieldCodec<F,E>
- All Known Implementing Classes:
AbstractLuceneNumericFieldCodec,LuceneBigDecimalFieldCodec,LuceneBigIntegerFieldCodec,LuceneBooleanFieldCodec,LuceneByteFieldCodec,LuceneDoubleFieldCodec,LuceneFieldFieldCodec,LuceneFloatFieldCodec,LuceneGeoPointFieldCodec,LuceneInstantFieldCodec,LuceneIntegerFieldCodec,LuceneLocalDateFieldCodec,LuceneLocalDateTimeFieldCodec,LuceneLocalTimeFieldCodec,LuceneLongFieldCodec,LuceneMonthDayFieldCodec,LuceneOffsetDateTimeFieldCodec,LuceneOffsetTimeFieldCodec,LuceneShortFieldCodec,LuceneStringFieldCodec,LuceneYearFieldCodec,LuceneYearMonthFieldCodec,LuceneZonedDateTimeFieldCodec
public interface LuceneFieldCodec<F>Defines how a given value will be encoded in the Lucene document and how it will be decoded.Encodes values received from an
IndexFieldReferencewhen indexing, and returns decoded values to the hit extractor when projecting in a search query.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddToDocument(LuceneDocumentContent documentBuilder, String absoluteFieldPath, F value)Encode the given value in the document by adding new fields to the Lucene document.Fdecode(org.apache.lucene.index.IndexableField field)Extract the value from the given stored field.booleanisCompatibleWith(LuceneFieldCodec<?> other)Determine whether the given codec provides an encoding that is compatible with this codec, i.e.
-
-
-
Method Detail
-
addToDocument
void addToDocument(LuceneDocumentContent documentBuilder, String absoluteFieldPath, F value)
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
F decode(org.apache.lucene.index.IndexableField field)
Extract the value from the given stored field.Typically used in projections.
- Parameters:
field- The document field. Nevernull.- Returns:
- The decoded value.
-
isCompatibleWith
boolean isCompatibleWith(LuceneFieldCodec<?> other)
Determine whether the given codec provides an encoding that is compatible with this codec, i.e. whether itsdecode(IndexableField)andLuceneStandardFieldCodec.encode(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.
-
-