Class DecayFunctionBuilder.AbstractDistanceScoreFunction

java.lang.Object
org.elasticsearch.common.lucene.search.function.ScoreFunction
org.elasticsearch.index.query.functionscore.DecayFunctionBuilder.AbstractDistanceScoreFunction
Enclosing class:
DecayFunctionBuilder<DFB extends DecayFunctionBuilder<DFB>>

public abstract static class DecayFunctionBuilder.AbstractDistanceScoreFunction extends ScoreFunction
This is the base class for scoring a single field.
  • Field Details

    • offset

      protected final double offset
    • mode

      protected final MultiValueMode mode
  • Constructor Details

    • AbstractDistanceScoreFunction

      public AbstractDistanceScoreFunction(double userSuppiedScale, double decay, double offset, DecayFunction func, MultiValueMode mode)
  • Method Details

    • distance

      protected abstract NumericDoubleValues distance(org.apache.lucene.index.LeafReaderContext context)
      This function computes the distance from a defined origin. Since the value of the document is read from the index, it cannot be guaranteed that the value actually exists. If it does not, we assume the user handles this case in the query and return 0.
    • getLeafScoreFunction

      public final LeafScoreFunction getLeafScoreFunction(org.apache.lucene.index.LeafReaderContext ctx)
      Specified by:
      getLeafScoreFunction in class ScoreFunction
    • getDistanceString

      protected abstract String getDistanceString(org.apache.lucene.index.LeafReaderContext ctx, int docId) throws IOException
      Throws:
      IOException
    • getFieldName

      protected abstract String getFieldName()
    • doEquals

      protected boolean doEquals(ScoreFunction other)
      Description copied from class: ScoreFunction
      Indicates whether some other ScoreFunction object of the same type is "equal to" this one.
      Specified by:
      doEquals in class ScoreFunction
    • doHashCode

      protected int doHashCode()
      Specified by:
      doHashCode in class ScoreFunction