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 Modifier and Type Field Description protected MultiValueMode
mode
protected double
offset
-
Constructor Summary
Constructors Constructor Description AbstractDistanceScoreFunction(double userSuppiedScale, double decay, double offset, DecayFunction func, MultiValueMode mode)
-
Method Summary
Modifier and Type Method Description protected 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
doHashCode()
protected abstract java.lang.String
getDistanceString(org.apache.lucene.index.LeafReaderContext ctx, int docId)
protected abstract java.lang.String
getFieldName()
LeafScoreFunction
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
-
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 java.lang.String getDistanceString(org.apache.lucene.index.LeafReaderContext ctx, int docId) throws java.io.IOException- Throws:
java.io.IOException
-
getFieldName
protected abstract java.lang.String 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
-