| | 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 the magnitude of a |
| | 19 | | /// numeric field. |
| | 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("magnitude")] |
| | 25 | | public partial class MagnitudeScoringFunction : ScoringFunction |
| | 26 | | { |
| | 27 | | /// <summary> |
| | 28 | | /// Initializes a new instance of the MagnitudeScoringFunction class. |
| | 29 | | /// </summary> |
| 266 | 30 | | public MagnitudeScoringFunction() |
| | 31 | | { |
| | 32 | | CustomInit(); |
| 266 | 33 | | } |
| | 34 | |
|
| | 35 | | /// <summary> |
| | 36 | | /// Initializes a new instance of the MagnitudeScoringFunction 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 magnitude 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 MagnitudeScoringFunction(string fieldName, double boost, MagnitudeScoringParameters parameters, ScoringFu |
| 284 | 49 | | : base(fieldName, boost, interpolation) |
| | 50 | | { |
| 284 | 51 | | Parameters = parameters; |
| | 52 | | CustomInit(); |
| 284 | 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 magnitude scoring function. |
| | 62 | | /// </summary> |
| | 63 | | [JsonProperty(PropertyName = "magnitude")] |
| 1700 | 64 | | public MagnitudeScoringParameters 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 | | { |
| 272 | 74 | | base.Validate(); |
| 272 | 75 | | if (Parameters == null) |
| | 76 | | { |
| 0 | 77 | | throw new ValidationException(ValidationRules.CannotBeNull, "Parameters"); |
| | 78 | | } |
| 272 | 79 | | if (Parameters != null) |
| | 80 | | { |
| 272 | 81 | | Parameters.Validate(); |
| | 82 | | } |
| 272 | 83 | | } |
| | 84 | | } |
| | 85 | | } |