Interface IndexableField
-
- All Known Implementing Classes:
AssociationFacetField
,BinaryDocValuesField
,ByteDocValuesField
,DerefBytesDocValuesField
,DoubleDocValuesField
,DoubleField
,FacetField
,Field
,FloatAssociationFacetField
,FloatDocValuesField
,FloatField
,IntAssociationFacetField
,IntDocValuesField
,IntField
,LazyDocument.LazyField
,LongDocValuesField
,LongField
,NumericDocValuesField
,PackedLongDocValuesField
,ShortDocValuesField
,SortedBytesDocValuesField
,SortedDocValuesField
,SortedSetDocValuesFacetField
,SortedSetDocValuesField
,StoredField
,StraightBytesDocValuesField
,StringField
,TextField
public interface IndexableField
Represents a single field for indexing. IndexWriter consumes Iterable<IndexableField> as a document.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BytesRef
binaryValue()
Non-null if this field has a binary valuefloat
boost()
Returns the field's index-time boost.IndexableFieldType
fieldType()
IndexableFieldType
describing the properties of this field.java.lang.String
name()
Field namejava.lang.Number
numericValue()
Non-null if this field has a numeric valuejava.io.Reader
readerValue()
Non-null if this field has a Reader valuejava.lang.String
stringValue()
Non-null if this field has a string valueTokenStream
tokenStream(Analyzer analyzer)
Creates the TokenStream used for indexing this field.
-
-
-
Method Detail
-
name
java.lang.String name()
Field name
-
fieldType
IndexableFieldType fieldType()
IndexableFieldType
describing the properties of this field.
-
boost
float boost()
Returns the field's index-time boost.Only fields can have an index-time boost, if you want to simulate a "document boost", then you must pre-multiply it across all the relevant fields yourself.
The boost is used to compute the norm factor for the field. By default, in the
Similarity.computeNorm(FieldInvertState)
method, the boost value is multiplied by the length normalization factor and then rounded byDefaultSimilarity.encodeNormValue(float)
before it is stored in the index. One should attempt to ensure that this product does not overflow the range of that encoding.It is illegal to return a boost other than 1.0f for a field that is not indexed (
IndexableFieldType.indexed()
is false) or omits normalization values (IndexableFieldType.omitNorms()
returns true).
-
binaryValue
BytesRef binaryValue()
Non-null if this field has a binary value
-
stringValue
java.lang.String stringValue()
Non-null if this field has a string value
-
readerValue
java.io.Reader readerValue()
Non-null if this field has a Reader value
-
numericValue
java.lang.Number numericValue()
Non-null if this field has a numeric value
-
tokenStream
TokenStream tokenStream(Analyzer analyzer) throws java.io.IOException
Creates the TokenStream used for indexing this field. If appropriate, implementations should use the given Analyzer to create the TokenStreams.- Parameters:
analyzer
- Analyzer that should be used to create the TokenStreams from- Returns:
- TokenStream value for indexing the document. Should always return a non-null value if the field is to be indexed
- Throws:
java.io.IOException
- Can be thrown while creating the TokenStream
-
-