Class RandomScoreFunction
java.lang.Object
org.elasticsearch.common.lucene.search.function.ScoreFunction
org.elasticsearch.common.lucene.search.function.RandomScoreFunction
Pseudo randomly generate a score for each
LeafScoreFunction.score(int, float).-
Constructor Summary
ConstructorsConstructorDescriptionRandomScoreFunction(int seed, int salt, IndexFieldData<?> uidFieldData)Creates a RandomScoreFunction. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleandoEquals(ScoreFunction other)Indicates whether some otherScoreFunctionobject of the same type is "equal to" this one.protected intgetLeafScoreFunction(org.apache.lucene.index.LeafReaderContext ctx)booleanIndicates if document scores are needed by this function.Methods inherited from class org.elasticsearch.common.lucene.search.function.ScoreFunction
equals, getDefaultScoreCombiner, getWeight, hashCode, rewrite
-
Constructor Details
-
RandomScoreFunction
Creates a RandomScoreFunction.- Parameters:
seed- A seed for randomnesssalt- A value to salt the seed with, ideally unique to the running node/indexuidFieldData- The field data for _uid to use for generating consistent random values for the same id
-
-
Method Details
-
getLeafScoreFunction
- Specified by:
getLeafScoreFunctionin classScoreFunction
-
needsScores
public boolean needsScores()Description copied from class:ScoreFunctionIndicates if document scores are needed by this function.- Specified by:
needsScoresin classScoreFunction- Returns:
trueif scores are needed.
-
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
-