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