java.lang.Object
org.apache.lucene.document.Field
org.elasticsearch.index.mapper.vectors.XFeatureField
All Implemented Interfaces:
org.apache.lucene.index.IndexableField

public final class XFeatureField extends org.apache.lucene.document.Field
This class is forked from the Lucene FeatureField implementation to enable support for storing term vectors. It should be removed once apache/lucene#14034 becomes available.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.lucene.document.Field

    org.apache.lucene.document.Field.Store
  • Field Summary

    Fields inherited from class org.apache.lucene.document.Field

    fieldsData, name, type
  • Constructor Summary

    Constructors
    Constructor
    Description
    XFeatureField(String fieldName, String featureName, float featureValue)
    Create a feature.
    XFeatureField(String fieldName, String featureName, float featureValue, boolean storeTermVectors)
    Create a feature.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    This is useful if you have multiple features sharing a name and you want to take action to deduplicate them.
    void
    setFeatureValue(float featureValue)
    Update the feature value of this field.
    org.apache.lucene.analysis.TokenStream
    tokenStream(org.apache.lucene.analysis.Analyzer analyzer, org.apache.lucene.analysis.TokenStream reuse)
     

    Methods inherited from class org.apache.lucene.document.Field

    binaryValue, fieldType, getCharSequenceValue, invertableType, name, numericValue, readerValue, setBytesValue, setBytesValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, storedValue, stringValue, tokenStreamValue, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • XFeatureField

      public XFeatureField(String fieldName, String featureName, float featureValue)
      Create a feature.
      Parameters:
      fieldName - The name of the field to store the information into. All features may be stored in the same field.
      featureName - The name of the feature, eg. 'pagerank`. It will be indexed as a term.
      featureValue - The value of the feature, must be a positive, finite, normal float.
    • XFeatureField

      public XFeatureField(String fieldName, String featureName, float featureValue, boolean storeTermVectors)
      Create a feature.
      Parameters:
      fieldName - The name of the field to store the information into. All features may be stored in the same field.
      featureName - The name of the feature, eg. 'pagerank`. It will be indexed as a term.
      featureValue - The value of the feature, must be a positive, finite, normal float.
  • Method Details

    • setFeatureValue

      public void setFeatureValue(float featureValue)
      Update the feature value of this field.
    • tokenStream

      public org.apache.lucene.analysis.TokenStream tokenStream(org.apache.lucene.analysis.Analyzer analyzer, org.apache.lucene.analysis.TokenStream reuse)
      Specified by:
      tokenStream in interface org.apache.lucene.index.IndexableField
      Overrides:
      tokenStream in class org.apache.lucene.document.Field
    • getFeatureValue

      public float getFeatureValue()
      This is useful if you have multiple features sharing a name and you want to take action to deduplicate them.
      Returns:
      the feature value of this field.