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,Writeable,ToXContent,ToXContentFragment
- Direct Known Subclasses:
ExponentialDecayFunctionBuilder,GaussDecayFunctionBuilder,LinearDecayFunctionBuilder
public abstract class DecayFunctionBuilder<DFB extends DecayFunctionBuilder<DFB>> extends ScoreFunctionBuilder<DFB>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDecayFunctionBuilder.AbstractDistanceScoreFunctionThis is the base class for scoring a single field.-
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 protected static java.lang.StringDECAYstatic doubleDEFAULT_DECAYstatic MultiValueModeDEFAULT_MULTI_VALUE_MODEprotected static java.lang.StringOFFSETprotected static java.lang.StringORIGINprotected static java.lang.StringSCALE-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDecayFunctionBuilder(java.lang.String fieldName, java.lang.Object origin, java.lang.Object scale, java.lang.Object offset)Convenience constructor that converts its parameters into json to parse on the data nodes.protectedDecayFunctionBuilder(java.lang.String fieldName, java.lang.Object origin, java.lang.Object scale, java.lang.Object offset, double decay)Convenience constructor that converts its parameters into json to parse on the data nodes.protectedDecayFunctionBuilder(java.lang.String fieldName, BytesReference functionBytes)protectedDecayFunctionBuilder(StreamInput in)Read from a stream.
-
Method Summary
Modifier and Type Method Description protected booleandoEquals(DFB 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.protected abstract DecayFunctiongetDecayFunction()Override this function if you want to produce your own scorer.java.lang.StringgetFieldName()BytesReferencegetFunctionBytes()MultiValueModegetMultiValueMode()DFBsetMultiValueMode(MultiValueMode multiValueMode)-
Methods inherited from class org.elasticsearch.index.query.functionscore.ScoreFunctionBuilder
equals, getName, 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
-
ORIGIN
protected static final java.lang.String ORIGIN
- See Also:
- Constant Field Values
-
SCALE
protected static final java.lang.String SCALE
- See Also:
- Constant Field Values
-
DECAY
protected static final java.lang.String DECAY
- See Also:
- Constant Field Values
-
OFFSET
protected static final java.lang.String OFFSET
- See Also:
- Constant Field Values
-
DEFAULT_DECAY
public static double DEFAULT_DECAY
-
DEFAULT_MULTI_VALUE_MODE
public static MultiValueMode DEFAULT_MULTI_VALUE_MODE
-
-
Constructor Detail
-
DecayFunctionBuilder
protected DecayFunctionBuilder(java.lang.String fieldName, java.lang.Object origin, java.lang.Object scale, java.lang.Object offset)Convenience constructor that converts its parameters into json to parse on the data nodes.
-
DecayFunctionBuilder
protected DecayFunctionBuilder(java.lang.String fieldName, java.lang.Object origin, java.lang.Object scale, java.lang.Object offset, double decay)Convenience constructor that converts its parameters into json to parse on the data nodes.
-
DecayFunctionBuilder
protected DecayFunctionBuilder(java.lang.String fieldName, BytesReference functionBytes)
-
DecayFunctionBuilder
protected DecayFunctionBuilder(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<DFB extends DecayFunctionBuilder<DFB>>- Throws:
java.io.IOException
-
getFieldName
public java.lang.String getFieldName()
-
getFunctionBytes
public BytesReference getFunctionBytes()
-
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<DFB extends DecayFunctionBuilder<DFB>>- Throws:
java.io.IOException
-
setMultiValueMode
public DFB setMultiValueMode(MultiValueMode multiValueMode)
-
getMultiValueMode
public MultiValueMode getMultiValueMode()
-
doEquals
protected boolean doEquals(DFB 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<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
protected ScoreFunction doToFunction(QueryShardContext context) throws java.io.IOException
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:
java.io.IOException
-
getDecayFunction
protected abstract DecayFunction getDecayFunction()
Override this function if you want to produce your own scorer.
-
-