| | 1 | | // <auto-generated> |
| | 2 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 3 | | // Licensed under the MIT License. See License.txt in the project root for |
| | 4 | | // license information. |
| | 5 | | // |
| | 6 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 7 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 8 | | // regenerated. |
| | 9 | | // </auto-generated> |
| | 10 | |
|
| | 11 | | namespace Microsoft.Azure.Search.Models |
| | 12 | | { |
| | 13 | | using Microsoft.Rest; |
| | 14 | | using Newtonsoft.Json; |
| | 15 | | using System.Linq; |
| | 16 | |
|
| | 17 | | /// <summary> |
| | 18 | | /// Defines a function that boosts scores based on distance from a |
| | 19 | | /// geographic location. |
| | 20 | | /// <see |
| | 21 | | /// href="https://docs.microsoft.com/rest/api/searchservice/Add-scoring-profiles-to-a-search-index" |
| | 22 | | /// /> |
| | 23 | | /// </summary> |
| | 24 | | [Newtonsoft.Json.JsonObject("distance")] |
| | 25 | | public partial class DistanceScoringFunction : ScoringFunction |
| | 26 | | { |
| | 27 | | /// <summary> |
| | 28 | | /// Initializes a new instance of the DistanceScoringFunction class. |
| | 29 | | /// </summary> |
| 486 | 30 | | public DistanceScoringFunction() |
| | 31 | | { |
| | 32 | | CustomInit(); |
| 486 | 33 | | } |
| | 34 | |
|
| | 35 | | /// <summary> |
| | 36 | | /// Initializes a new instance of the DistanceScoringFunction class. |
| | 37 | | /// </summary> |
| | 38 | | /// <param name="fieldName">The name of the field used as input to the |
| | 39 | | /// scoring function.</param> |
| | 40 | | /// <param name="boost">A multiplier for the raw score. Must be a |
| | 41 | | /// positive number not equal to 1.0.</param> |
| | 42 | | /// <param name="parameters">Parameter values for the distance scoring |
| | 43 | | /// function.</param> |
| | 44 | | /// <param name="interpolation">A value indicating how boosting will be |
| | 45 | | /// interpolated across document scores; defaults to "Linear". Possible |
| | 46 | | /// values include: 'linear', 'constant', 'quadratic', |
| | 47 | | /// 'logarithmic'</param> |
| | 48 | | public DistanceScoringFunction(string fieldName, double boost, DistanceScoringParameters parameters, ScoringFunc |
| 478 | 49 | | : base(fieldName, boost, interpolation) |
| | 50 | | { |
| 478 | 51 | | Parameters = parameters; |
| | 52 | | CustomInit(); |
| 478 | 53 | | } |
| | 54 | |
|
| | 55 | | /// <summary> |
| | 56 | | /// An initialization method that performs custom operations like setting defaults |
| | 57 | | /// </summary> |
| | 58 | | partial void CustomInit(); |
| | 59 | |
|
| | 60 | | /// <summary> |
| | 61 | | /// Gets or sets parameter values for the distance scoring function. |
| | 62 | | /// </summary> |
| | 63 | | [JsonProperty(PropertyName = "distance")] |
| 2904 | 64 | | public DistanceScoringParameters Parameters { get; set; } |
| | 65 | |
|
| | 66 | | /// <summary> |
| | 67 | | /// Validate the object. |
| | 68 | | /// </summary> |
| | 69 | | /// <exception cref="ValidationException"> |
| | 70 | | /// Thrown if validation fails |
| | 71 | | /// </exception> |
| | 72 | | public override void Validate() |
| | 73 | | { |
| 480 | 74 | | base.Validate(); |
| 480 | 75 | | if (Parameters == null) |
| | 76 | | { |
| 0 | 77 | | throw new ValidationException(ValidationRules.CannotBeNull, "Parameters"); |
| | 78 | | } |
| 480 | 79 | | if (Parameters != null) |
| | 80 | | { |
| 480 | 81 | | Parameters.Validate(); |
| | 82 | | } |
| 480 | 83 | | } |
| | 84 | | } |
| | 85 | | } |