Class LuceneStringFieldCodec
- java.lang.Object
-
- org.hibernate.search.backend.lucene.types.codec.impl.LuceneStringFieldCodec
-
- All Implemented Interfaces:
LuceneFieldCodec<String>,LuceneStandardFieldCodec<String,String>
public final class LuceneStringFieldCodec extends Object implements LuceneStandardFieldCodec<String,String>
-
-
Constructor Summary
Constructors Constructor Description LuceneStringFieldCodec(org.apache.lucene.document.FieldType mainFieldType, DocValues docValues, String indexNullAsValue, org.apache.lucene.analysis.Analyzer analyzerOrNormalizer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddToDocument(LuceneDocumentContent documentBuilder, String absoluteFieldPath, String value)Encode the given value in the document by adding new fields to the Lucene document.Stringdecode(org.apache.lucene.index.IndexableField field)Extract the value from the given stored field.Stringencode(String value)Encode the given value.booleanisCompatibleWith(LuceneFieldCodec<?> obj)Determine whether the given codec provides an encoding that is compatible with this codec, i.e.
-
-
-
Method Detail
-
addToDocument
public void addToDocument(LuceneDocumentContent documentBuilder, String absoluteFieldPath, String value)
Description copied from interface:LuceneFieldCodecEncode the given value in the document by adding new fields to the Lucene document.- Specified by:
addToDocumentin interfaceLuceneFieldCodec<String>- Parameters:
documentBuilder- The document builder.absoluteFieldPath- The absolute path of the field.value- The value to encode.
-
decode
public String decode(org.apache.lucene.index.IndexableField field)
Description copied from interface:LuceneFieldCodecExtract the value from the given stored field.Typically used in projections.
- Specified by:
decodein interfaceLuceneFieldCodec<String>- Parameters:
field- The document field. Nevernull.- Returns:
- The decoded value.
-
isCompatibleWith
public boolean isCompatibleWith(LuceneFieldCodec<?> obj)
Description copied from interface:LuceneFieldCodecDetermine whether the given codec provides an encoding that is compatible with this codec, i.e. whether itsLuceneFieldCodec.decode(IndexableField)andLuceneStandardFieldCodec.encode(Object)methods behave the same way.NOTE:
LuceneFieldCodec.addToDocument(LuceneDocumentContent, String, Object)may behave differently, e.g. it may add docvalues while this codec does not. The behavior ofLuceneFieldCodec.addToDocument(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.).- Specified by:
isCompatibleWithin interfaceLuceneFieldCodec<String>- Parameters:
obj- AnotherLuceneFieldCodec, nevernull.- Returns:
trueif the given codec is compatible.falseotherwise, or when in doubt.
-
encode
public String encode(String value)
Description copied from interface:LuceneStandardFieldCodecEncode the given value.Useful for predicates and sorts in particular.
- Specified by:
encodein interfaceLuceneStandardFieldCodec<String,String>- Parameters:
value- The value to encode.
-
-