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 MultiValueModemodeprotected doubleoffset -
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 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 intdoHashCode()protected abstract java.lang.StringgetDistanceString(org.apache.lucene.index.LeafReaderContext ctx, int docId)protected abstract java.lang.StringgetFieldName()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
-
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 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: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
-