public class RandomScoreFunctionBuilder extends ScoreFunctionBuilder<RandomScoreFunctionBuilder>
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Writeable.Reader<V>, Writeable.Writer<V>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
EMPTY_PARAMS
Constructor and Description |
---|
RandomScoreFunctionBuilder() |
RandomScoreFunctionBuilder(StreamInput in)
Read from a stream.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
doEquals(RandomScoreFunctionBuilder functionBuilder)
Check that two instances of the same subclass of ScoreFunctionBuilder are equal.
|
protected int |
doHashCode()
Hashcode for fields defined in this subclass of ScoreFunctionBuilder.
|
protected ScoreFunction |
doToFunction(QueryShardContext context)
Build the Lucene ScoreFunction for this builder.
|
protected void |
doWriteTo(StreamOutput out)
Write the subclass's components into the stream.
|
void |
doXContent(XContentBuilder builder,
ToXContent.Params params)
Convert this subclass's data into XContent.
|
static RandomScoreFunctionBuilder |
fromXContent(XContentParser parser) |
java.lang.String |
getField()
Get the field to use for random number generation.
|
java.lang.String |
getName()
The name of this score function.
|
java.lang.Integer |
getSeed() |
RandomScoreFunctionBuilder |
seed(int seed)
Sets the seed based on which the random number will be generated.
|
RandomScoreFunctionBuilder |
seed(long seed)
seed variant taking a long value.
|
RandomScoreFunctionBuilder |
seed(java.lang.String seed)
seed variant taking a String value.
|
RandomScoreFunctionBuilder |
setField(java.lang.String field)
Set the field to be used for random number generation.
|
equals, getWeight, getWriteableName, hashCode, setWeight, toFunction, toXContent, writeTo
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
isFragment
public static final java.lang.String NAME
public RandomScoreFunctionBuilder()
public RandomScoreFunctionBuilder(StreamInput in) throws java.io.IOException
java.io.IOException
protected void doWriteTo(StreamOutput out) throws java.io.IOException
ScoreFunctionBuilder
doWriteTo
in class ScoreFunctionBuilder<RandomScoreFunctionBuilder>
java.io.IOException
public java.lang.String getName()
ScoreFunctionBuilder
getName
in class ScoreFunctionBuilder<RandomScoreFunctionBuilder>
public RandomScoreFunctionBuilder seed(int seed)
seed
- The seed.public RandomScoreFunctionBuilder seed(long seed)
seed(int)
public RandomScoreFunctionBuilder seed(java.lang.String seed)
seed(int)
public java.lang.Integer getSeed()
public RandomScoreFunctionBuilder setField(java.lang.String field)
seed
is set and ignored otherwise. Note that documents that
have the same value for a field will get the same score.public java.lang.String getField()
setField(String)
public void doXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
ScoreFunctionBuilder
doXContent
in class ScoreFunctionBuilder<RandomScoreFunctionBuilder>
java.io.IOException
protected boolean doEquals(RandomScoreFunctionBuilder functionBuilder)
ScoreFunctionBuilder
doEquals
in class ScoreFunctionBuilder<RandomScoreFunctionBuilder>
protected int doHashCode()
ScoreFunctionBuilder
doHashCode
in class ScoreFunctionBuilder<RandomScoreFunctionBuilder>
protected ScoreFunction doToFunction(QueryShardContext context)
ScoreFunctionBuilder
doToFunction
in class ScoreFunctionBuilder<RandomScoreFunctionBuilder>
public static RandomScoreFunctionBuilder fromXContent(XContentParser parser) throws java.io.IOException, ParsingException
java.io.IOException
ParsingException