org.apache.lucene.index

## Interface IndexableField

- All Known Implementing Classes:
    BinaryDocValuesField, BinaryPoint, DoubleDocValuesField, DoublePoint, DoubleRange, Field, FloatDocValuesField, FloatPoint, FloatRange, IntPoint, IntRange, LegacyDoubleField, LegacyFloatField, LegacyIntField, LegacyLongField, LongPoint, LongRange, NumericDocValuesField, SortedDocValuesField, SortedNumericDocValuesField, SortedSetDocValuesField, StoredField, StoredFieldsWriter.MergeVisitor, StringField, TextField

      public interface IndexableField

  Represents a single field for indexing. IndexWriter consumes Iterable<IndexableField> as a document.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `BytesRef` | `binaryValue()` Non-null if this field has a binary value
    `float` | `boost()` Deprecated. Index-time boosts are deprecated, please index index-time scoring factors into a doc value field and combine them with the score at query time using eg. FunctionScoreQuery.
    `IndexableFieldType` | `fieldType()` `IndexableFieldType` describing the properties of this field.
    `String` | `name()` Field name
    `Number` | `numericValue()` Non-null if this field has a numeric value
    `Reader` | `readerValue()` Non-null if this field has a Reader value
    `String` | `stringValue()` Non-null if this field has a string value
    `TokenStream` | `tokenStream(Analyzer analyzer, TokenStream reuse)` Creates the TokenStream used for indexing this field.

- - ### Method Detail

    - #### name

          String name()

      Field name

    - #### fieldType

          IndexableFieldType fieldType()

      `IndexableFieldType` describing the properties of this field.

    - #### tokenStream

          TokenStream tokenStream(Analyzer analyzer,
                                  TokenStream reuse)

      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
        `reuse` - TokenStream for a previous instance of this field name. This allows custom field types (like StringField and NumericField) that do not use the analyzer to still have good performance. Note: the passed-in type may be inappropriate, for example if you mix up different types of Fields for the same field name. So it's the responsibility of the implementation to check.
      Returns:
        TokenStream value for indexing the document. Should always return a non-null value if the field is to be indexed

    - #### boost

          @Deprecated
          float boost()

      Deprecated. Index-time boosts are deprecated, please index index-time scoring factors into a doc value field and combine them with the score at query time using eg. FunctionScoreQuery.
      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 by `ClassicSimilarity.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.indexOptions()` is IndexOptions.NONE) or omits normalization values (`IndexableFieldType.omitNorms()` returns true).

      See Also:
        `Similarity.computeNorm(FieldInvertState)`, `ClassicSimilarity.encodeNormValue(float)`

    - #### binaryValue

          BytesRef binaryValue()

      Non-null if this field has a binary value

    - #### stringValue

          String stringValue()

      Non-null if this field has a string value

    - #### readerValue

          Reader readerValue()

      Non-null if this field has a Reader value

    - #### numericValue

          Number numericValue()

      Non-null if this field has a numeric value

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.