| | 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 | | /// Removes words that are too long or too short. 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/miscellaneous/LengthFilte |
| | 22 | | /// /> |
| | 23 | | /// </summary> |
| | 24 | | [Newtonsoft.Json.JsonObject("#Microsoft.Azure.Search.LengthTokenFilter")] |
| | 25 | | public partial class LengthTokenFilter : TokenFilter |
| | 26 | | { |
| | 27 | | /// <summary> |
| | 28 | | /// Initializes a new instance of the LengthTokenFilter class. |
| | 29 | | /// </summary> |
| 4 | 30 | | public LengthTokenFilter() |
| | 31 | | { |
| | 32 | | CustomInit(); |
| 4 | 33 | | } |
| | 34 | |
|
| | 35 | | /// <summary> |
| | 36 | | /// Initializes a new instance of the LengthTokenFilter 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="min">The minimum length in characters. Default is 0. |
| | 43 | | /// Maximum is 300. Must be less than the value of max.</param> |
| | 44 | | /// <param name="max">The maximum length in characters. Default and |
| | 45 | | /// maximum is 300.</param> |
| | 46 | | public LengthTokenFilter(string name, int? min = default(int?), int? max = default(int?)) |
| 6 | 47 | | : base(name) |
| | 48 | | { |
| 6 | 49 | | Min = min; |
| 6 | 50 | | Max = max; |
| | 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 length in characters. Default is 0. |
| | 61 | | /// Maximum is 300. Must be less than the value of max. |
| | 62 | | /// </summary> |
| | 63 | | [JsonProperty(PropertyName = "min")] |
| 26 | 64 | | public int? Min { get; set; } |
| | 65 | |
|
| | 66 | | /// <summary> |
| | 67 | | /// Gets or sets the maximum length in characters. Default and maximum |
| | 68 | | /// is 300. |
| | 69 | | /// </summary> |
| | 70 | | [JsonProperty(PropertyName = "max")] |
| 26 | 71 | | public int? Max { 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 (Min > 300) |
| | 83 | | { |
| 0 | 84 | | throw new ValidationException(ValidationRules.InclusiveMaximum, "Min", 300); |
| | 85 | | } |
| 4 | 86 | | if (Max > 300) |
| | 87 | | { |
| 0 | 88 | | throw new ValidationException(ValidationRules.InclusiveMaximum, "Max", 300); |
| | 89 | | } |
| 4 | 90 | | } |
| | 91 | | } |
| | 92 | | } |