Class ScoreFunctionBuilder<FB extends ScoreFunctionBuilder<FB>>
- java.lang.Object
-
- org.elasticsearch.index.query.functionscore.ScoreFunctionBuilder<FB>
-
- All Implemented Interfaces:
NamedWriteable
,Writeable
,ToXContent
,ToXContentFragment
- Direct Known Subclasses:
DecayFunctionBuilder
,FieldValueFactorFunctionBuilder
,RandomScoreFunctionBuilder
,ScriptScoreFunctionBuilder
,WeightBuilder
public abstract class ScoreFunctionBuilder<FB extends ScoreFunctionBuilder<FB>> extends java.lang.Object implements ToXContentFragment, NamedWriteable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
-
Field Summary
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description ScoreFunctionBuilder()
Standard empty constructor.ScoreFunctionBuilder(StreamInput in)
Read from a stream.
-
Method Summary
Modifier and Type Method Description protected abstract boolean
doEquals(FB functionBuilder)
Check that two instances of the same subclass of ScoreFunctionBuilder are equal.protected abstract int
doHashCode()
Hashcode for fields defined in this subclass of ScoreFunctionBuilder.protected abstract ScoreFunction
doToFunction(QueryShardContext context)
Build the Lucene ScoreFunction for this builder.protected abstract void
doWriteTo(StreamOutput out)
Write the subclass's components into the stream.protected abstract void
doXContent(XContentBuilder builder, ToXContent.Params params)
Convert this subclass's data into XContent.boolean
equals(java.lang.Object obj)
abstract java.lang.String
getName()
The name of this score function.java.lang.Float
getWeight()
The weight applied to the function before combining.java.lang.String
getWriteableName()
Returns the name of the writeable objectint
hashCode()
FB
setWeight(float weight)
Set the weight applied to the function before combining.ScoreFunction
toFunction(QueryShardContext context)
Called on a data node, converts this ScoreFunctionBuilder into its corresponding Lucene function object.XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Constructor Detail
-
ScoreFunctionBuilder
public ScoreFunctionBuilder()
Standard empty constructor.
-
ScoreFunctionBuilder
public ScoreFunctionBuilder(StreamInput in) throws java.io.IOException
Read from a stream.- Throws:
java.io.IOException
-
-
Method Detail
-
writeTo
public final void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:Writeable
Write this into the StreamOutput.
-
doWriteTo
protected abstract void doWriteTo(StreamOutput out) throws java.io.IOException
Write the subclass's components into the stream.- Throws:
java.io.IOException
-
getName
public abstract java.lang.String getName()
The name of this score function.
-
setWeight
public final FB setWeight(float weight)
Set the weight applied to the function before combining.
-
getWeight
public final java.lang.Float getWeight()
The weight applied to the function before combining.
-
toXContent
public final XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
doXContent
protected abstract void doXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
Convert this subclass's data into XContent.- Throws:
java.io.IOException
-
getWriteableName
public final java.lang.String getWriteableName()
Description copied from interface:NamedWriteable
Returns the name of the writeable object- Specified by:
getWriteableName
in interfaceNamedWriteable
-
equals
public final boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
doEquals
protected abstract boolean doEquals(FB functionBuilder)
Check that two instances of the same subclass of ScoreFunctionBuilder are equal. Implementers don't need to check any fields in ScoreFunctionBuilder, just fields that they define.
-
hashCode
public final int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
doHashCode
protected abstract int doHashCode()
Hashcode for fields defined in this subclass of ScoreFunctionBuilder. Implementers should ignore fields defined in ScoreFunctionBuilder because they will already be in the hashCode.
-
toFunction
public final ScoreFunction toFunction(QueryShardContext context) throws java.io.IOException
Called on a data node, converts this ScoreFunctionBuilder into its corresponding Lucene function object.- Throws:
java.io.IOException
-
doToFunction
protected abstract ScoreFunction doToFunction(QueryShardContext context) throws java.io.IOException
Build the Lucene ScoreFunction for this builder. Implementers should ignore things defined in ScoreFunctionBuilder like weight as they will be handled by the function that calls this one.- Throws:
java.io.IOException
-
-