Class ScoreFunctionBuilder<FB extends ScoreFunctionBuilder<FB>>

    • Constructor Detail

      • ScoreFunctionBuilder

        public ScoreFunctionBuilder()
        Standard empty constructor.
      • ScoreFunctionBuilder

        public ScoreFunctionBuilder​(StreamInput in)
                             throws java.io.IOException
        Read from a stream.
        Throws:
        java.io.IOException
    • Method Detail

      • doWriteTo

        protected abstract void doWriteTo​(StreamOutput out)
                                   throws java.io.IOException
        Write the subclass's components into the stream.
        Throws:
        java.io.IOException
      • 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.
      • doXContent

        protected abstract void doXContent​(XContentBuilder builder,
                                           ToXContent.Params params)
                                    throws java.io.IOException
        Convert this subclass's data into XContent.
        Throws:
        java.io.IOException
      • equals

        public final boolean equals​(java.lang.Object obj)
        Overrides:
        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()
        Overrides:
        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 java.io.IOException
        Called on a data node, converts this ScoreFunctionBuilder into its corresponding Lucene function object.
        Throws:
        java.io.IOException
      • doToFunction

        protected abstract ScoreFunction doToFunction​(QueryShardContext context)
                                               throws java.io.IOException
        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.
        Throws:
        java.io.IOException