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
ConstructorDescriptionRandomScoreFunction(int seed, int salt, IndexFieldData<?> uidFieldData)
Creates a RandomScoreFunction. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
doEquals(ScoreFunction other)
Indicates whether some otherScoreFunction
object of the same type is "equal to" this one.protected int
getLeafScoreFunction(org.apache.lucene.index.LeafReaderContext ctx)
boolean
Indicates 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:
getLeafScoreFunction
in classScoreFunction
-
needsScores
public boolean needsScores()Description copied from class:ScoreFunction
Indicates if document scores are needed by this function.- Specified by:
needsScores
in classScoreFunction
- Returns:
true
if scores are needed.
-
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
-