Class ScoreFunctionBuilder<FB extends ScoreFunctionBuilder<FB>>

All Implemented Interfaces:
NamedWriteable, Writeable, ToXContent, ToXContentFragment
Direct Known Subclasses:
DecayFunctionBuilder, FieldValueFactorFunctionBuilder, RandomScoreFunctionBuilder, ScriptScoreFunctionBuilder, WeightBuilder

public abstract class ScoreFunctionBuilder<FB extends ScoreFunctionBuilder<FB>>
extends java.lang.Object
implements ToXContentFragment, NamedWriteable
  • Constructor Details

  • Method Details

    • writeTo

      public final void writeTo​(StreamOutput out) throws
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
    • doWriteTo

      protected abstract void doWriteTo​(StreamOutput out) throws
      Write the subclass's components into the stream.
    • getName

      public abstract java.lang.String getName()
      The name of this score function.
    • setWeight

      public final FB setWeight​(float weight)
      Set the weight applied to the function before combining.
    • getWeight

      public final java.lang.Float getWeight()
      The weight applied to the function before combining.
    • toXContent

      public final XContentBuilder toXContent​(XContentBuilder builder, ToXContent.Params params) throws
      Specified by:
      toXContent in interface ToXContent
    • doXContent

      protected abstract void doXContent​(XContentBuilder builder, ToXContent.Params params) throws
      Convert this subclass's data into XContent.
    • getWriteableName

      public java.lang.String getWriteableName()
      Description copied from interface: NamedWriteable
      Returns the name of the writeable object
      Specified by:
      getWriteableName in interface NamedWriteable
    • equals

      public final boolean equals​(java.lang.Object obj)
      equals in class java.lang.Object
    • doEquals

      protected abstract boolean doEquals​(FB functionBuilder)
      Check that two instances of the same subclass of ScoreFunctionBuilder are equal. Implementers don't need to check any fields in ScoreFunctionBuilder, just fields that they define.
    • hashCode

      public final int hashCode()
      hashCode in class java.lang.Object
    • doHashCode

      protected abstract int doHashCode()
      Hashcode for fields defined in this subclass of ScoreFunctionBuilder. Implementers should ignore fields defined in ScoreFunctionBuilder because they will already be in the hashCode.
    • toFunction

      public final ScoreFunction toFunction​(QueryShardContext context) throws
      Called on a data node, converts this ScoreFunctionBuilder into its corresponding Lucene function object.
    • doToFunction

      protected abstract ScoreFunction doToFunction​(QueryShardContext context) throws
      Build the Lucene ScoreFunction for this builder. Implementers should ignore things defined in ScoreFunctionBuilder like weight as they will be handled by the function that calls this one.