Class ScoringFunction

java.lang.Object
com.azure.search.documents.indexes.models.ScoringFunction
All Implemented Interfaces:
com.azure.json.JsonSerializable<ScoringFunction>
Direct Known Subclasses:
DistanceScoringFunction, FreshnessScoringFunction, MagnitudeScoringFunction, TagScoringFunction

public class ScoringFunction extends Object implements com.azure.json.JsonSerializable<ScoringFunction>
Base type for functions that can modify document scores during ranking.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ScoringFunction(String fieldName, double boost)
    Creates an instance of ScoringFunction class.
  • Method Summary

    Modifier and Type
    Method
    Description
    fromJson(com.azure.json.JsonReader jsonReader)
    Reads an instance of ScoringFunction from the JsonReader.
    double
    Get the boost property: A multiplier for the raw score.
    Get the fieldName property: The name of the field used as input to the scoring function.
    Get the interpolation property: A value indicating how boosting will be interpolated across document scores; defaults to "Linear".
    Get the type property: Indicates the type of function to use.
    Set the interpolation property: A value indicating how boosting will be interpolated across document scores; defaults to "Linear".
    com.azure.json.JsonWriter
    toJson(com.azure.json.JsonWriter jsonWriter)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.azure.json.JsonSerializable

    toJson, toJson, toJsonBytes, toJsonString
  • Constructor Details

    • ScoringFunction

      public ScoringFunction(String fieldName, double boost)
      Creates an instance of ScoringFunction class.
      Parameters:
      fieldName - the fieldName value to set.
      boost - the boost value to set.
  • Method Details

    • 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.
      Returns:
      the type value.
    • getFieldName

      public String getFieldName()
      Get the fieldName property: The name of the field used as input to the scoring function.
      Returns:
      the fieldName value.
    • getBoost

      public double getBoost()
      Get the boost property: A multiplier for the raw score. Must be a positive number not equal to 1.0.
      Returns:
      the boost value.
    • getInterpolation

      public ScoringFunctionInterpolation getInterpolation()
      Get the interpolation property: A value indicating how boosting will be interpolated across document scores; defaults to "Linear".
      Returns:
      the interpolation value.
    • setInterpolation

      public ScoringFunction setInterpolation(ScoringFunctionInterpolation interpolation)
      Set the interpolation property: A value indicating how boosting will be interpolated across document scores; defaults to "Linear".
      Parameters:
      interpolation - the interpolation value to set.
      Returns:
      the ScoringFunction object itself.
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<ScoringFunction>
      Throws:
      IOException
    • fromJson

      public static ScoringFunction fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of ScoringFunction from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of ScoringFunction if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
      Throws:
      IllegalStateException - If the deserialized JSON object was missing any required properties.
      IOException - If an error occurs while reading the ScoringFunction.