Module org.elasticsearch.server
Class DecayFunctionBuilder<DFB extends DecayFunctionBuilder<DFB>>
java.lang.Object
org.elasticsearch.index.query.functionscore.ScoreFunctionBuilder<DFB>
org.elasticsearch.index.query.functionscore.DecayFunctionBuilder<DFB>
- All Implemented Interfaces:
NamedWriteable,VersionedNamedWriteable,Writeable,ToXContent,ToXContentFragment
- Direct Known Subclasses:
ExponentialDecayFunctionBuilder,GaussDecayFunctionBuilder,LinearDecayFunctionBuilder
public abstract class DecayFunctionBuilder<DFB extends DecayFunctionBuilder<DFB>>
extends ScoreFunctionBuilder<DFB>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis is the base class for scoring a single field.Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringstatic final doublestatic final MultiValueModeprotected static final Stringprotected static final Stringprotected static final StringFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDecayFunctionBuilder(String fieldName, Object origin, Object scale, Object offset) Convenience constructor that converts its parameters into json to parse on the data nodes.protectedDecayFunctionBuilder(String fieldName, Object origin, Object scale, Object offset, double decay) Convenience constructor that converts its parameters into json to parse on the data nodes.protectedDecayFunctionBuilder(String fieldName, BytesReference functionBytes) protectedRead from a stream. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanCheck that two instances of the same subclass of ScoreFunctionBuilder are equal.protected intHashcode for fields defined in this subclass of ScoreFunctionBuilder.protected ScoreFunctiondoToFunction(SearchExecutionContext 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.protected abstract DecayFunctionOverride this function if you want to produce your own scorer.setMultiValueMode(MultiValueMode multiValueMode) protected voidvalidateDecay(double decay) Override this function if you have different validation rules per score functionMethods inherited from class org.elasticsearch.index.query.functionscore.ScoreFunctionBuilder
equals, getName, getWeight, getWriteableName, hashCode, setWeight, toFunction, toXContent, writeToMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragmentMethods inherited from interface org.elasticsearch.common.io.stream.VersionedNamedWriteable
getMinimalSupportedVersion, supportsVersion
-
Field Details
-
ORIGIN
- See Also:
-
SCALE
- See Also:
-
DECAY
- See Also:
-
OFFSET
- See Also:
-
DEFAULT_DECAY
public static final double DEFAULT_DECAY- See Also:
-
DEFAULT_MULTI_VALUE_MODE
-
-
Constructor Details
-
DecayFunctionBuilder
Convenience constructor that converts its parameters into json to parse on the data nodes. -
DecayFunctionBuilder
protected DecayFunctionBuilder(String fieldName, Object origin, Object scale, Object offset, double decay) Convenience constructor that converts its parameters into json to parse on the data nodes. -
DecayFunctionBuilder
-
DecayFunctionBuilder
Read from a stream.- Throws:
IOException
-
-
Method Details
-
validateDecay
protected void validateDecay(double decay) Override this function if you have different validation rules per score function -
doWriteTo
Description copied from class:ScoreFunctionBuilderWrite the subclass's components into the stream.- Specified by:
doWriteToin classScoreFunctionBuilder<DFB extends DecayFunctionBuilder<DFB>>- Throws:
IOException
-
getFieldName
-
getFunctionBytes
-
doXContent
Description copied from class:ScoreFunctionBuilderConvert this subclass's data into XContent.- Specified by:
doXContentin classScoreFunctionBuilder<DFB extends DecayFunctionBuilder<DFB>>- Throws:
IOException
-
setMultiValueMode
-
getMultiValueMode
-
doEquals
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<DFB extends DecayFunctionBuilder<DFB>>
-
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<DFB extends DecayFunctionBuilder<DFB>>
-
doToFunction
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<DFB extends DecayFunctionBuilder<DFB>>- Throws:
IOException
-
getDecayFunction
Override this function if you want to produce your own scorer.
-