| | 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) starting from the front or the |
| | 19 | | /// back of an input token. This token filter is implemented using Apache |
| | 20 | | /// Lucene. |
| | 21 | | /// <see |
| | 22 | | /// href="http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/ngram/EdgeNGramTokenFilte |
| | 23 | | /// /> |
| | 24 | | /// </summary> |
| | 25 | | [Newtonsoft.Json.JsonObject("#Microsoft.Azure.Search.EdgeNGramTokenFilterV2")] |
| | 26 | | public partial class EdgeNGramTokenFilterV2 : TokenFilter |
| | 27 | | { |
| | 28 | | /// <summary> |
| | 29 | | /// Initializes a new instance of the EdgeNGramTokenFilterV2 class. |
| | 30 | | /// </summary> |
| 8 | 31 | | public EdgeNGramTokenFilterV2() |
| | 32 | | { |
| | 33 | | CustomInit(); |
| 8 | 34 | | } |
| | 35 | |
|
| | 36 | | /// <summary> |
| | 37 | | /// Initializes a new instance of the EdgeNGramTokenFilterV2 class. |
| | 38 | | /// </summary> |
| | 39 | | /// <param name="name">The name of the token filter. It must only |
| | 40 | | /// contain letters, digits, spaces, dashes or underscores, can only |
| | 41 | | /// start and end with alphanumeric characters, and is limited to 128 |
| | 42 | | /// characters.</param> |
| | 43 | | /// <param name="minGram">The minimum n-gram length. Default is 1. |
| | 44 | | /// Maximum is 300. Must be less than the value of maxGram.</param> |
| | 45 | | /// <param name="maxGram">The maximum n-gram length. Default is 2. |
| | 46 | | /// Maximum is 300.</param> |
| | 47 | | /// <param name="side">Specifies which side of the input the n-gram |
| | 48 | | /// should be generated from. Default is "front". Possible values |
| | 49 | | /// include: 'front', 'back'</param> |
| | 50 | | public EdgeNGramTokenFilterV2(string name, int? minGram = default(int?), int? maxGram = default(int?), EdgeNGram |
| 10 | 51 | | : base(name) |
| | 52 | | { |
| 10 | 53 | | MinGram = minGram; |
| 10 | 54 | | MaxGram = maxGram; |
| 10 | 55 | | Side = side; |
| | 56 | | CustomInit(); |
| 10 | 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")] |
| 50 | 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")] |
| 50 | 76 | | public int? MaxGram { get; set; } |
| | 77 | |
|
| | 78 | | /// <summary> |
| | 79 | | /// Gets or sets specifies which side of the input the n-gram should be |
| | 80 | | /// generated from. Default is "front". Possible values include: |
| | 81 | | /// 'front', 'back' |
| | 82 | | /// </summary> |
| | 83 | | [JsonProperty(PropertyName = "side")] |
| 42 | 84 | | public EdgeNGramTokenFilterSide? Side { get; set; } |
| | 85 | |
|
| | 86 | | /// <summary> |
| | 87 | | /// Validate the object. |
| | 88 | | /// </summary> |
| | 89 | | /// <exception cref="ValidationException"> |
| | 90 | | /// Thrown if validation fails |
| | 91 | | /// </exception> |
| | 92 | | public override void Validate() |
| | 93 | | { |
| 8 | 94 | | base.Validate(); |
| 8 | 95 | | if (MinGram > 300) |
| | 96 | | { |
| 0 | 97 | | throw new ValidationException(ValidationRules.InclusiveMaximum, "MinGram", 300); |
| | 98 | | } |
| 8 | 99 | | if (MaxGram > 300) |
| | 100 | | { |
| 0 | 101 | | throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxGram", 300); |
| | 102 | | } |
| 8 | 103 | | } |
| | 104 | | } |
| | 105 | | } |