| | 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 | | /// Abstract base class for functions that can modify document scores |
| | 19 | | /// during ranking. |
| | 20 | | /// <see |
| | 21 | | /// href="https://docs.microsoft.com/rest/api/searchservice/Add-scoring-profiles-to-a-search-index" |
| | 22 | | /// /> |
| | 23 | | /// </summary> |
| | 24 | | public partial class ScoringFunction |
| | 25 | | { |
| | 26 | | /// <summary> |
| | 27 | | /// Initializes a new instance of the ScoringFunction class. |
| | 28 | | /// </summary> |
| 928 | 29 | | public ScoringFunction() |
| | 30 | | { |
| | 31 | | CustomInit(); |
| 928 | 32 | | } |
| | 33 | |
|
| | 34 | | /// <summary> |
| | 35 | | /// Initializes a new instance of the ScoringFunction class. |
| | 36 | | /// </summary> |
| | 37 | | /// <param name="fieldName">The name of the field used as input to the |
| | 38 | | /// scoring function.</param> |
| | 39 | | /// <param name="boost">A multiplier for the raw score. Must be a |
| | 40 | | /// positive number not equal to 1.0.</param> |
| | 41 | | /// <param name="interpolation">A value indicating how boosting will be |
| | 42 | | /// interpolated across document scores; defaults to "Linear". Possible |
| | 43 | | /// values include: 'linear', 'constant', 'quadratic', |
| | 44 | | /// 'logarithmic'</param> |
| 950 | 45 | | public ScoringFunction(string fieldName, double boost, ScoringFunctionInterpolation? interpolation = default(Sco |
| | 46 | | { |
| 950 | 47 | | FieldName = fieldName; |
| 950 | 48 | | Boost = boost; |
| 950 | 49 | | Interpolation = interpolation; |
| | 50 | | CustomInit(); |
| 950 | 51 | | } |
| | 52 | |
|
| | 53 | | /// <summary> |
| | 54 | | /// An initialization method that performs custom operations like setting defaults |
| | 55 | | /// </summary> |
| | 56 | | partial void CustomInit(); |
| | 57 | |
|
| | 58 | | /// <summary> |
| | 59 | | /// Gets or sets the name of the field used as input to the scoring |
| | 60 | | /// function. |
| | 61 | | /// </summary> |
| | 62 | | [JsonProperty(PropertyName = "fieldName")] |
| 3862 | 63 | | public string FieldName { get; set; } |
| | 64 | |
|
| | 65 | | /// <summary> |
| | 66 | | /// Gets or sets a multiplier for the raw score. Must be a positive |
| | 67 | | /// number not equal to 1.0. |
| | 68 | | /// </summary> |
| | 69 | | [JsonProperty(PropertyName = "boost")] |
| 2930 | 70 | | public double Boost { get; set; } |
| | 71 | |
|
| | 72 | | /// <summary> |
| | 73 | | /// Gets or sets a value indicating how boosting will be interpolated |
| | 74 | | /// across document scores; defaults to "Linear". Possible values |
| | 75 | | /// include: 'linear', 'constant', 'quadratic', 'logarithmic' |
| | 76 | | /// </summary> |
| | 77 | | [JsonProperty(PropertyName = "interpolation")] |
| 3120 | 78 | | public ScoringFunctionInterpolation? Interpolation { get; set; } |
| | 79 | |
|
| | 80 | | /// <summary> |
| | 81 | | /// Validate the object. |
| | 82 | | /// </summary> |
| | 83 | | /// <exception cref="ValidationException"> |
| | 84 | | /// Thrown if validation fails |
| | 85 | | /// </exception> |
| | 86 | | public virtual void Validate() |
| | 87 | | { |
| 932 | 88 | | if (FieldName == null) |
| | 89 | | { |
| 0 | 90 | | throw new ValidationException(ValidationRules.CannotBeNull, "FieldName"); |
| | 91 | | } |
| 932 | 92 | | } |
| | 93 | | } |
| | 94 | | } |