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
-
Constructor Summary
ConstructorDescriptionAbstractDistanceScoreFunction(double userSuppiedScale, double decay, double offset, DecayFunction func, MultiValueMode mode)
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract NumericDoubleValues
distance(org.apache.lucene.index.LeafReaderContext context)
This function computes the distance from a defined origin.protected boolean
doEquals(ScoreFunction other)
Indicates whether some otherScoreFunction
object of the same type is "equal to" this one.protected int
protected abstract String
getDistanceString(org.apache.lucene.index.LeafReaderContext ctx, int docId)
protected abstract String
getLeafScoreFunction(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:
getLeafScoreFunction
in classScoreFunction
-
getDistanceString
protected abstract String getDistanceString(org.apache.lucene.index.LeafReaderContext ctx, int docId) throws IOException- Throws:
IOException
-
getFieldName
-
doEquals
Description copied from class:ScoreFunction
Indicates whether some otherScoreFunction
object of the same type is "equal to" this one.- Specified by:
doEquals
in classScoreFunction
-
doHashCode
protected int doHashCode()- Specified by:
doHashCode
in classScoreFunction
-