Class RandomScoreFunction
- java.lang.Object
-
- org.elasticsearch.common.lucene.search.function.ScoreFunction
-
- org.elasticsearch.common.lucene.search.function.RandomScoreFunction
-
public class RandomScoreFunction extends ScoreFunction
Pseudo randomly generate a score for eachLeafScoreFunction.score(int, float)
.
-
-
Constructor Summary
Constructors Constructor Description RandomScoreFunction(int seed, int salt, IndexFieldData<?> uidFieldData)
Creates a RandomScoreFunction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
doEquals(ScoreFunction other)
Indicates whether some otherScoreFunction
object of the same type is "equal to" this one.protected int
doHashCode()
LeafScoreFunction
getLeafScoreFunction(org.apache.lucene.index.LeafReaderContext ctx)
boolean
needsScores()
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 Detail
-
RandomScoreFunction
public RandomScoreFunction(int seed, int salt, IndexFieldData<?> uidFieldData)
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 Detail
-
getLeafScoreFunction
public LeafScoreFunction getLeafScoreFunction(org.apache.lucene.index.LeafReaderContext ctx)
- 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
protected boolean doEquals(ScoreFunction other)
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
-
-