Class FieldValueFactorFunctionBuilder
- java.lang.Object
-
- org.elasticsearch.index.query.functionscore.ScoreFunctionBuilder<FieldValueFactorFunctionBuilder>
-
- org.elasticsearch.index.query.functionscore.FieldValueFactorFunctionBuilder
-
- All Implemented Interfaces:
NamedWriteable,Writeable,ToXContent,ToXContentFragment
public class FieldValueFactorFunctionBuilder extends ScoreFunctionBuilder<FieldValueFactorFunctionBuilder>
Builder to constructfield_value_factorfunctions for a function score query.
-
-
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 Modifier and Type Field Description static floatDEFAULT_FACTORstatic FieldValueFactorFunction.ModifierDEFAULT_MODIFIERstatic java.lang.StringNAME-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description FieldValueFactorFunctionBuilder(java.lang.String fieldName)FieldValueFactorFunctionBuilder(StreamInput in)Read from a stream.
-
Method Summary
Modifier and Type Method Description protected booleandoEquals(FieldValueFactorFunctionBuilder functionBuilder)Check that two instances of the same subclass of ScoreFunctionBuilder are equal.protected intdoHashCode()Hashcode for fields defined in this subclass of ScoreFunctionBuilder.protected ScoreFunctiondoToFunction(QueryShardContext context)Build the Lucene ScoreFunction for this builder.protected voiddoWriteTo(StreamOutput out)Write the subclass's components into the stream.voiddoXContent(XContentBuilder builder, ToXContent.Params params)Convert this subclass's data into XContent.floatfactor()FieldValueFactorFunctionBuilderfactor(float boostFactor)java.lang.StringfieldName()static FieldValueFactorFunctionBuilderfromXContent(XContentParser parser)java.lang.StringgetName()The name of this score function.java.lang.Doublemissing()FieldValueFactorFunctionBuildermissing(double missing)Value used instead of the field value for documents that don't have that field defined.FieldValueFactorFunction.Modifiermodifier()FieldValueFactorFunctionBuildermodifier(FieldValueFactorFunction.Modifier modifier)-
Methods inherited from class org.elasticsearch.index.query.functionscore.ScoreFunctionBuilder
equals, getWeight, getWriteableName, hashCode, setWeight, toFunction, toXContent, writeTo
-
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
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
DEFAULT_MODIFIER
public static final FieldValueFactorFunction.Modifier DEFAULT_MODIFIER
-
DEFAULT_FACTOR
public static final float DEFAULT_FACTOR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FieldValueFactorFunctionBuilder
public FieldValueFactorFunctionBuilder(java.lang.String fieldName)
-
FieldValueFactorFunctionBuilder
public FieldValueFactorFunctionBuilder(StreamInput in) throws java.io.IOException
Read from a stream.- Throws:
java.io.IOException
-
-
Method Detail
-
doWriteTo
protected void doWriteTo(StreamOutput out) throws java.io.IOException
Description copied from class:ScoreFunctionBuilderWrite the subclass's components into the stream.- Specified by:
doWriteToin classScoreFunctionBuilder<FieldValueFactorFunctionBuilder>- Throws:
java.io.IOException
-
getName
public java.lang.String getName()
Description copied from class:ScoreFunctionBuilderThe name of this score function.- Specified by:
getNamein classScoreFunctionBuilder<FieldValueFactorFunctionBuilder>
-
fieldName
public java.lang.String fieldName()
-
factor
public FieldValueFactorFunctionBuilder factor(float boostFactor)
-
factor
public float factor()
-
missing
public FieldValueFactorFunctionBuilder missing(double missing)
Value used instead of the field value for documents that don't have that field defined.
-
missing
public java.lang.Double missing()
-
modifier
public FieldValueFactorFunctionBuilder modifier(FieldValueFactorFunction.Modifier modifier)
-
modifier
public FieldValueFactorFunction.Modifier modifier()
-
doXContent
public void doXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
Description copied from class:ScoreFunctionBuilderConvert this subclass's data into XContent.- Specified by:
doXContentin classScoreFunctionBuilder<FieldValueFactorFunctionBuilder>- Throws:
java.io.IOException
-
doEquals
protected boolean doEquals(FieldValueFactorFunctionBuilder functionBuilder)
Description copied from class:ScoreFunctionBuilderCheck 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.- Specified by:
doEqualsin classScoreFunctionBuilder<FieldValueFactorFunctionBuilder>
-
doHashCode
protected int doHashCode()
Description copied from class:ScoreFunctionBuilderHashcode for fields defined in this subclass of ScoreFunctionBuilder. Implementers should ignore fields defined in ScoreFunctionBuilder because they will already be in the hashCode.- Specified by:
doHashCodein classScoreFunctionBuilder<FieldValueFactorFunctionBuilder>
-
doToFunction
protected ScoreFunction doToFunction(QueryShardContext context)
Description copied from class:ScoreFunctionBuilderBuild 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.- Specified by:
doToFunctionin classScoreFunctionBuilder<FieldValueFactorFunctionBuilder>
-
fromXContent
public static FieldValueFactorFunctionBuilder fromXContent(XContentParser parser) throws java.io.IOException, ParsingException
- Throws:
java.io.IOExceptionParsingException
-
-