| | 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 | | /// Represents a search index definition, which describes the fields and |
| | 21 | | /// search behavior of an index. |
| | 22 | | /// </summary> |
| | 23 | | public partial class Index |
| | 24 | | { |
| | 25 | | /// <summary> |
| | 26 | | /// Initializes a new instance of the Index class. |
| | 27 | | /// </summary> |
| 1150 | 28 | | public Index() |
| | 29 | | { |
| | 30 | | CustomInit(); |
| 1150 | 31 | | } |
| | 32 | |
|
| | 33 | | /// <summary> |
| | 34 | | /// Initializes a new instance of the Index class. |
| | 35 | | /// </summary> |
| | 36 | | /// <param name="name">The name of the index.</param> |
| | 37 | | /// <param name="fields">The fields of the index.</param> |
| | 38 | | /// <param name="scoringProfiles">The scoring profiles for the |
| | 39 | | /// index.</param> |
| | 40 | | /// <param name="defaultScoringProfile">The name of the scoring profile |
| | 41 | | /// to use if none is specified in the query. If this property is not |
| | 42 | | /// set and no scoring profile is specified in the query, then default |
| | 43 | | /// scoring (tf-idf) will be used.</param> |
| | 44 | | /// <param name="corsOptions">Options to control Cross-Origin Resource |
| | 45 | | /// Sharing (CORS) for the index.</param> |
| | 46 | | /// <param name="suggesters">The suggesters for the index.</param> |
| | 47 | | /// <param name="analyzers">The analyzers for the index.</param> |
| | 48 | | /// <param name="tokenizers">The tokenizers for the index.</param> |
| | 49 | | /// <param name="tokenFilters">The token filters for the index.</param> |
| | 50 | | /// <param name="charFilters">The character filters for the |
| | 51 | | /// index.</param> |
| | 52 | | /// <param name="eTag">The ETag of the index.</param> |
| 44 | 53 | | public Index(string name, IList<Field> fields, IList<ScoringProfile> scoringProfiles = default(IList<ScoringProf |
| | 54 | | { |
| 44 | 55 | | Name = name; |
| 44 | 56 | | Fields = fields; |
| 44 | 57 | | ScoringProfiles = scoringProfiles; |
| 44 | 58 | | DefaultScoringProfile = defaultScoringProfile; |
| 44 | 59 | | CorsOptions = corsOptions; |
| 44 | 60 | | Suggesters = suggesters; |
| 44 | 61 | | Analyzers = analyzers; |
| 44 | 62 | | Tokenizers = tokenizers; |
| 44 | 63 | | TokenFilters = tokenFilters; |
| 44 | 64 | | CharFilters = charFilters; |
| 44 | 65 | | ETag = eTag; |
| | 66 | | CustomInit(); |
| 44 | 67 | | } |
| | 68 | |
|
| | 69 | | /// <summary> |
| | 70 | | /// An initialization method that performs custom operations like setting defaults |
| | 71 | | /// </summary> |
| | 72 | | partial void CustomInit(); |
| | 73 | |
|
| | 74 | | /// <summary> |
| | 75 | | /// Gets or sets the name of the index. |
| | 76 | | /// </summary> |
| | 77 | | [JsonProperty(PropertyName = "name")] |
| 2796 | 78 | | public string Name { get; set; } |
| | 79 | |
|
| | 80 | | /// <summary> |
| | 81 | | /// Gets or sets the fields of the index. |
| | 82 | | /// </summary> |
| | 83 | | [JsonProperty(PropertyName = "fields")] |
| 4406 | 84 | | public IList<Field> Fields { get; set; } |
| | 85 | |
|
| | 86 | | /// <summary> |
| | 87 | | /// Gets or sets the scoring profiles for the index. |
| | 88 | | /// </summary> |
| | 89 | | [JsonProperty(PropertyName = "scoringProfiles")] |
| 3436 | 90 | | public IList<ScoringProfile> ScoringProfiles { get; set; } |
| | 91 | |
|
| | 92 | | /// <summary> |
| | 93 | | /// Gets or sets the name of the scoring profile to use if none is |
| | 94 | | /// specified in the query. If this property is not set and no scoring |
| | 95 | | /// profile is specified in the query, then default scoring (tf-idf) |
| | 96 | | /// will be used. |
| | 97 | | /// </summary> |
| | 98 | | [JsonProperty(PropertyName = "defaultScoringProfile")] |
| 848 | 99 | | public string DefaultScoringProfile { get; set; } |
| | 100 | |
|
| | 101 | | /// <summary> |
| | 102 | | /// Gets or sets options to control Cross-Origin Resource Sharing |
| | 103 | | /// (CORS) for the index. |
| | 104 | | /// </summary> |
| | 105 | | [JsonProperty(PropertyName = "corsOptions")] |
| 1644 | 106 | | public CorsOptions CorsOptions { get; set; } |
| | 107 | |
|
| | 108 | | /// <summary> |
| | 109 | | /// Gets or sets the suggesters for the index. |
| | 110 | | /// </summary> |
| | 111 | | [JsonProperty(PropertyName = "suggesters")] |
| 3504 | 112 | | public IList<Suggester> Suggesters { get; set; } |
| | 113 | |
|
| | 114 | | /// <summary> |
| | 115 | | /// Gets or sets the analyzers for the index. |
| | 116 | | /// </summary> |
| | 117 | | [JsonProperty(PropertyName = "analyzers")] |
| 2814 | 118 | | public IList<Analyzer> Analyzers { get; set; } |
| | 119 | |
|
| | 120 | | /// <summary> |
| | 121 | | /// Gets or sets the tokenizers for the index. |
| | 122 | | /// </summary> |
| | 123 | | [JsonProperty(PropertyName = "tokenizers")] |
| 3256 | 124 | | public IList<Tokenizer> Tokenizers { get; set; } |
| | 125 | |
|
| | 126 | | /// <summary> |
| | 127 | | /// Gets or sets the token filters for the index. |
| | 128 | | /// </summary> |
| | 129 | | [JsonProperty(PropertyName = "tokenFilters")] |
| 3598 | 130 | | public IList<TokenFilter> TokenFilters { get; set; } |
| | 131 | |
|
| | 132 | | /// <summary> |
| | 133 | | /// Gets or sets the character filters for the index. |
| | 134 | | /// </summary> |
| | 135 | | [JsonProperty(PropertyName = "charFilters")] |
| 2610 | 136 | | public IList<CharFilter> CharFilters { get; set; } |
| | 137 | |
|
| | 138 | | /// <summary> |
| | 139 | | /// Gets or sets the ETag of the index. |
| | 140 | | /// </summary> |
| | 141 | | [JsonProperty(PropertyName = "@odata.etag")] |
| 1284 | 142 | | public string ETag { get; set; } |
| | 143 | |
|
| | 144 | | /// <summary> |
| | 145 | | /// Validate the object. |
| | 146 | | /// </summary> |
| | 147 | | /// <exception cref="ValidationException"> |
| | 148 | | /// Thrown if validation fails |
| | 149 | | /// </exception> |
| | 150 | | public virtual void Validate() |
| | 151 | | { |
| 594 | 152 | | if (Name == null) |
| | 153 | | { |
| 0 | 154 | | throw new ValidationException(ValidationRules.CannotBeNull, "Name"); |
| | 155 | | } |
| 594 | 156 | | if (Fields == null) |
| | 157 | | { |
| 0 | 158 | | throw new ValidationException(ValidationRules.CannotBeNull, "Fields"); |
| | 159 | | } |
| 594 | 160 | | if (Fields != null) |
| | 161 | | { |
| 16252 | 162 | | foreach (var element in Fields) |
| | 163 | | { |
| 7532 | 164 | | if (element != null) |
| | 165 | | { |
| 7532 | 166 | | element.Validate(); |
| | 167 | | } |
| | 168 | | } |
| | 169 | | } |
| 594 | 170 | | if (ScoringProfiles != null) |
| | 171 | | { |
| 2476 | 172 | | foreach (var element1 in ScoringProfiles) |
| | 173 | | { |
| 752 | 174 | | if (element1 != null) |
| | 175 | | { |
| 752 | 176 | | element1.Validate(); |
| | 177 | | } |
| | 178 | | } |
| | 179 | | } |
| 594 | 180 | | if (CorsOptions != null) |
| | 181 | | { |
| 94 | 182 | | CorsOptions.Validate(); |
| | 183 | | } |
| 594 | 184 | | if (Suggesters != null) |
| | 185 | | { |
| 2100 | 186 | | foreach (var element2 in Suggesters) |
| | 187 | | { |
| 524 | 188 | | if (element2 != null) |
| | 189 | | { |
| 524 | 190 | | element2.Validate(); |
| | 191 | | } |
| | 192 | | } |
| | 193 | | } |
| 594 | 194 | | if (Analyzers != null) |
| | 195 | | { |
| 232 | 196 | | foreach (var element3 in Analyzers) |
| | 197 | | { |
| 74 | 198 | | if (element3 != null) |
| | 199 | | { |
| 74 | 200 | | element3.Validate(); |
| | 201 | | } |
| | 202 | | } |
| | 203 | | } |
| 594 | 204 | | if (Tokenizers != null) |
| | 205 | | { |
| 496 | 206 | | foreach (var element4 in Tokenizers) |
| | 207 | | { |
| 218 | 208 | | if (element4 != null) |
| | 209 | | { |
| 218 | 210 | | element4.Validate(); |
| | 211 | | } |
| | 212 | | } |
| | 213 | | } |
| 594 | 214 | | if (TokenFilters != null) |
| | 215 | | { |
| 724 | 216 | | foreach (var element5 in TokenFilters) |
| | 217 | | { |
| 330 | 218 | | if (element5 != null) |
| | 219 | | { |
| 330 | 220 | | element5.Validate(); |
| | 221 | | } |
| | 222 | | } |
| | 223 | | } |
| 594 | 224 | | if (CharFilters != null) |
| | 225 | | { |
| 72 | 226 | | foreach (var element6 in CharFilters) |
| | 227 | | { |
| 8 | 228 | | if (element6 != null) |
| | 229 | | { |
| 8 | 230 | | element6.Validate(); |
| | 231 | | } |
| | 232 | | } |
| | 233 | | } |
| 594 | 234 | | } |
| | 235 | | } |
| | 236 | | } |