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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractDistanceScoreFunction(double userSuppiedScale, double decay, double offset, DecayFunction func, MultiValueMode mode) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract NumericDoubleValuesdistance(org.apache.lucene.index.LeafReaderContext context) This function computes the distance from a defined origin.protected booleandoEquals(ScoreFunction other) Indicates whether some otherScoreFunctionobject of the same type is "equal to" this one.protected intprotected abstract StringgetDistanceString(org.apache.lucene.index.LeafReaderContext ctx, int docId) protected abstract Stringfinal LeafScoreFunctiongetLeafScoreFunction(org.apache.lucene.index.LeafReaderContext ctx) Methods inherited from class org.elasticsearch.common.lucene.search.function.ScoreFunction
equals, getDefaultScoreCombiner, getWeight, hashCode, needsScores, rewrite
-
Field Details
-
offset
protected final double offset -
mode
-
-
Constructor Details
-
AbstractDistanceScoreFunction
public AbstractDistanceScoreFunction(double userSuppiedScale, double decay, double offset, DecayFunction func, MultiValueMode mode)
-
-
Method Details
-
distance
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
- Specified by:
getLeafScoreFunctionin classScoreFunction
-
getDistanceString
protected abstract String getDistanceString(org.apache.lucene.index.LeafReaderContext ctx, int docId) throws IOException - Throws:
IOException
-
getFieldName
-
doEquals
Description copied from class:ScoreFunctionIndicates whether some otherScoreFunctionobject of the same type is "equal to" this one.- Specified by:
doEqualsin classScoreFunction
-
doHashCode
protected int doHashCode()- Specified by:
doHashCodein classScoreFunction
-