Class DistanceScoringFunction

java.lang.Object
com.azure.search.documents.indexes.models.ScoringFunction
com.azure.search.documents.indexes.models.DistanceScoringFunction
All Implemented Interfaces:
com.azure.json.JsonSerializable<ScoringFunction>

public final class DistanceScoringFunction extends ScoringFunction
Defines a function that boosts scores based on distance from a geographic location.
  • Constructor Details

    • DistanceScoringFunction

      public DistanceScoringFunction(String fieldName, double boost, DistanceScoringParameters parameters)
      Creates an instance of DistanceScoringFunction class.
      Parameters:
      fieldName - the fieldName value to set.
      boost - the boost value to set.
      parameters - the parameters 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.
      Overrides:
      getType in class ScoringFunction
      Returns:
      the type value.
    • getParameters

      public DistanceScoringParameters getParameters()
      Get the parameters property: Parameter values for the distance scoring function.
      Returns:
      the parameters value.
    • setInterpolation

      public DistanceScoringFunction setInterpolation(ScoringFunctionInterpolation interpolation)
      Set the interpolation property: A value indicating how boosting will be interpolated across document scores; defaults to "Linear".
      Overrides:
      setInterpolation in class ScoringFunction
      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>
      Overrides:
      toJson in class ScoringFunction
      Throws:
      IOException
    • fromJson

      public static DistanceScoringFunction fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of DistanceScoringFunction from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of DistanceScoringFunction 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 DistanceScoringFunction.