Share via


MagnitudeScoringFunction Class

public final class MagnitudeScoringFunction
extends ScoringFunction

Defines a function that boosts scores based on the magnitude of a numeric field.

Constructor Summary

Constructor Description
MagnitudeScoringFunction(String fieldName, double boost, MagnitudeScoringParameters parameters)

Creates an instance of MagnitudeScoringFunction class.

Method Summary

Modifier and Type Method and Description
static MagnitudeScoringFunction fromJson(JsonReader jsonReader)

Reads an instance of MagnitudeScoringFunction from the JsonReader.

MagnitudeScoringParameters getParameters()

Get the parameters property: Parameter values for the magnitude scoring function.

String getType()

Get the type property: Indicates the type of function to use.

MagnitudeScoringFunction setInterpolation(ScoringFunctionInterpolation interpolation)

Set the interpolation property: A value indicating how boosting will be interpolated across document scores; defaults to "Linear".

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from ScoringFunction

Methods inherited from java.lang.Object

Constructor Details

MagnitudeScoringFunction

public MagnitudeScoringFunction(String fieldName, double boost, MagnitudeScoringParameters parameters)

Creates an instance of MagnitudeScoringFunction class.

Parameters:

fieldName - the fieldName value to set.
boost - the boost value to set.
parameters - the parameters value to set.

Method Details

fromJson

public static MagnitudeScoringFunction fromJson(JsonReader jsonReader)

Reads an instance of MagnitudeScoringFunction from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of MagnitudeScoringFunction if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

getParameters

public MagnitudeScoringParameters getParameters()

Get the parameters property: Parameter values for the magnitude scoring function.

Returns:

the parameters value.

getType

public String getType()

Get the type property: Indicates the type of function to use. Valid values include magnitude, freshness, distance, and tag. The function type must be lower case.

Overrides:

MagnitudeScoringFunction.getType()

Returns:

the type value.

setInterpolation

public MagnitudeScoringFunction setInterpolation(ScoringFunctionInterpolation interpolation)

Set the interpolation property: A value indicating how boosting will be interpolated across document scores; defaults to "Linear".

Overrides:

MagnitudeScoringFunction.setInterpolation(ScoringFunctionInterpolation interpolation)

Parameters:

interpolation

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Overrides:

MagnitudeScoringFunction.toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to