| | 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.Collections; |
| | 16 | | using System.Collections.Generic; |
| | 17 | | using System.Linq; |
| | 18 | |
|
| | 19 | | /// <summary> |
| | 20 | | /// Defines parameters for a search index that influence scoring in search |
| | 21 | | /// queries. |
| | 22 | | /// <see |
| | 23 | | /// href="https://docs.microsoft.com/rest/api/searchservice/Add-scoring-profiles-to-a-search-index" |
| | 24 | | /// /> |
| | 25 | | /// </summary> |
| | 26 | | public partial class ScoringProfile |
| | 27 | | { |
| | 28 | | /// <summary> |
| | 29 | | /// Initializes a new instance of the ScoringProfile class. |
| | 30 | | /// </summary> |
| 752 | 31 | | public ScoringProfile() |
| | 32 | | { |
| | 33 | | CustomInit(); |
| 752 | 34 | | } |
| | 35 | |
|
| | 36 | | /// <summary> |
| | 37 | | /// Initializes a new instance of the ScoringProfile class. |
| | 38 | | /// </summary> |
| | 39 | | /// <param name="name">The name of the scoring profile.</param> |
| | 40 | | /// <param name="textWeights">Parameters that boost scoring based on |
| | 41 | | /// text matches in certain index fields.</param> |
| | 42 | | /// <param name="functions">The collection of functions that influence |
| | 43 | | /// the scoring of documents.</param> |
| | 44 | | /// <param name="functionAggregation">A value indicating how the |
| | 45 | | /// results of individual scoring functions should be combined. |
| | 46 | | /// Defaults to "Sum". Ignored if there are no scoring functions. |
| | 47 | | /// Possible values include: 'sum', 'average', 'minimum', 'maximum', |
| | 48 | | /// 'firstMatching'</param> |
| 762 | 49 | | public ScoringProfile(string name, TextWeights textWeights = default(TextWeights), IList<ScoringFunction> functi |
| | 50 | | { |
| 762 | 51 | | Name = name; |
| 762 | 52 | | TextWeights = textWeights; |
| 762 | 53 | | Functions = functions; |
| 762 | 54 | | FunctionAggregation = functionAggregation; |
| | 55 | | CustomInit(); |
| 762 | 56 | | } |
| | 57 | |
|
| | 58 | | /// <summary> |
| | 59 | | /// An initialization method that performs custom operations like setting defaults |
| | 60 | | /// </summary> |
| | 61 | | partial void CustomInit(); |
| | 62 | |
|
| | 63 | | /// <summary> |
| | 64 | | /// Gets or sets the name of the scoring profile. |
| | 65 | | /// </summary> |
| | 66 | | [JsonProperty(PropertyName = "name")] |
| 3098 | 67 | | public string Name { get; set; } |
| | 68 | |
|
| | 69 | | /// <summary> |
| | 70 | | /// Gets or sets parameters that boost scoring based on text matches in |
| | 71 | | /// certain index fields. |
| | 72 | | /// </summary> |
| | 73 | | [JsonProperty(PropertyName = "text")] |
| 2706 | 74 | | public TextWeights TextWeights { get; set; } |
| | 75 | |
|
| | 76 | | /// <summary> |
| | 77 | | /// Gets or sets the collection of functions that influence the scoring |
| | 78 | | /// of documents. |
| | 79 | | /// </summary> |
| | 80 | | [JsonProperty(PropertyName = "functions")] |
| 5366 | 81 | | public IList<ScoringFunction> Functions { get; set; } |
| | 82 | |
|
| | 83 | | /// <summary> |
| | 84 | | /// Gets or sets a value indicating how the results of individual |
| | 85 | | /// scoring functions should be combined. Defaults to "Sum". Ignored if |
| | 86 | | /// there are no scoring functions. Possible values include: 'sum', |
| | 87 | | /// 'average', 'minimum', 'maximum', 'firstMatching' |
| | 88 | | /// </summary> |
| | 89 | | [JsonProperty(PropertyName = "functionAggregation")] |
| 3860 | 90 | | public ScoringFunctionAggregation? FunctionAggregation { get; set; } |
| | 91 | |
|
| | 92 | | /// <summary> |
| | 93 | | /// Validate the object. |
| | 94 | | /// </summary> |
| | 95 | | /// <exception cref="ValidationException"> |
| | 96 | | /// Thrown if validation fails |
| | 97 | | /// </exception> |
| | 98 | | public virtual void Validate() |
| | 99 | | { |
| 752 | 100 | | if (Name == null) |
| | 101 | | { |
| 0 | 102 | | throw new ValidationException(ValidationRules.CannotBeNull, "Name"); |
| | 103 | | } |
| 752 | 104 | | if (TextWeights != null) |
| | 105 | | { |
| 90 | 106 | | TextWeights.Validate(); |
| | 107 | | } |
| 752 | 108 | | if (Functions != null) |
| | 109 | | { |
| 3368 | 110 | | foreach (var element in Functions) |
| | 111 | | { |
| 932 | 112 | | if (element != null) |
| | 113 | | { |
| 932 | 114 | | element.Validate(); |
| | 115 | | } |
| | 116 | | } |
| | 117 | | } |
| 752 | 118 | | } |
| | 119 | | } |
| | 120 | | } |