| | 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 | | /// Generates n-grams of the given size(s). This token filter is |
| | 19 | | /// implemented using Apache Lucene. |
| | 20 | | /// <see |
| | 21 | | /// href="http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/ngram/NGramTokenFilter.ht |
| | 22 | | /// /> |
| | 23 | | /// </summary> |
| | 24 | | [Newtonsoft.Json.JsonObject("#Microsoft.Azure.Search.NGramTokenFilterV2")] |
| | 25 | | public partial class NGramTokenFilterV2 : TokenFilter |
| | 26 | | { |
| | 27 | | /// <summary> |
| | 28 | | /// Initializes a new instance of the NGramTokenFilterV2 class. |
| | 29 | | /// </summary> |
| 4 | 30 | | public NGramTokenFilterV2() |
| | 31 | | { |
| | 32 | | CustomInit(); |
| 4 | 33 | | } |
| | 34 | |
|
| | 35 | | /// <summary> |
| | 36 | | /// Initializes a new instance of the NGramTokenFilterV2 class. |
| | 37 | | /// </summary> |
| | 38 | | /// <param name="name">The name of the token filter. It must only |
| | 39 | | /// contain letters, digits, spaces, dashes or underscores, can only |
| | 40 | | /// start and end with alphanumeric characters, and is limited to 128 |
| | 41 | | /// characters.</param> |
| | 42 | | /// <param name="minGram">The minimum n-gram length. Default is 1. |
| | 43 | | /// Maximum is 300. Must be less than the value of maxGram.</param> |
| | 44 | | /// <param name="maxGram">The maximum n-gram length. Default is 2. |
| | 45 | | /// Maximum is 300.</param> |
| | 46 | | public NGramTokenFilterV2(string name, int? minGram = default(int?), int? maxGram = default(int?)) |
| 6 | 47 | | : base(name) |
| | 48 | | { |
| 6 | 49 | | MinGram = minGram; |
| 6 | 50 | | MaxGram = maxGram; |
| | 51 | | CustomInit(); |
| 6 | 52 | | } |
| | 53 | |
|
| | 54 | | /// <summary> |
| | 55 | | /// An initialization method that performs custom operations like setting defaults |
| | 56 | | /// </summary> |
| | 57 | | partial void CustomInit(); |
| | 58 | |
|
| | 59 | | /// <summary> |
| | 60 | | /// Gets or sets the minimum n-gram length. Default is 1. Maximum is |
| | 61 | | /// 300. Must be less than the value of maxGram. |
| | 62 | | /// </summary> |
| | 63 | | [JsonProperty(PropertyName = "minGram")] |
| 26 | 64 | | public int? MinGram { get; set; } |
| | 65 | |
|
| | 66 | | /// <summary> |
| | 67 | | /// Gets or sets the maximum n-gram length. Default is 2. Maximum is |
| | 68 | | /// 300. |
| | 69 | | /// </summary> |
| | 70 | | [JsonProperty(PropertyName = "maxGram")] |
| 26 | 71 | | public int? MaxGram { get; set; } |
| | 72 | |
|
| | 73 | | /// <summary> |
| | 74 | | /// Validate the object. |
| | 75 | | /// </summary> |
| | 76 | | /// <exception cref="ValidationException"> |
| | 77 | | /// Thrown if validation fails |
| | 78 | | /// </exception> |
| | 79 | | public override void Validate() |
| | 80 | | { |
| 4 | 81 | | base.Validate(); |
| 4 | 82 | | if (MinGram > 300) |
| | 83 | | { |
| 0 | 84 | | throw new ValidationException(ValidationRules.InclusiveMaximum, "MinGram", 300); |
| | 85 | | } |
| 4 | 86 | | if (MaxGram > 300) |
| | 87 | | { |
| 0 | 88 | | throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxGram", 300); |
| | 89 | | } |
| 4 | 90 | | } |
| | 91 | | } |
| | 92 | | } |