| | 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 | | /// Truncates the terms to a specific length. 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/TruncateTok |
| | 22 | | /// /> |
| | 23 | | /// </summary> |
| | 24 | | [Newtonsoft.Json.JsonObject("#Microsoft.Azure.Search.TruncateTokenFilter")] |
| | 25 | | public partial class TruncateTokenFilter : TokenFilter |
| | 26 | | { |
| | 27 | | /// <summary> |
| | 28 | | /// Initializes a new instance of the TruncateTokenFilter class. |
| | 29 | | /// </summary> |
| 4 | 30 | | public TruncateTokenFilter() |
| | 31 | | { |
| | 32 | | CustomInit(); |
| 4 | 33 | | } |
| | 34 | |
|
| | 35 | | /// <summary> |
| | 36 | | /// Initializes a new instance of the TruncateTokenFilter 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="length">The length at which terms will be truncated. |
| | 43 | | /// Default and maximum is 300.</param> |
| | 44 | | public TruncateTokenFilter(string name, int? length = default(int?)) |
| 6 | 45 | | : base(name) |
| | 46 | | { |
| 6 | 47 | | Length = length; |
| | 48 | | CustomInit(); |
| 6 | 49 | | } |
| | 50 | |
|
| | 51 | | /// <summary> |
| | 52 | | /// An initialization method that performs custom operations like setting defaults |
| | 53 | | /// </summary> |
| | 54 | | partial void CustomInit(); |
| | 55 | |
|
| | 56 | | /// <summary> |
| | 57 | | /// Gets or sets the length at which terms will be truncated. Default |
| | 58 | | /// and maximum is 300. |
| | 59 | | /// </summary> |
| | 60 | | [JsonProperty(PropertyName = "length")] |
| 26 | 61 | | public int? Length { get; set; } |
| | 62 | |
|
| | 63 | | /// <summary> |
| | 64 | | /// Validate the object. |
| | 65 | | /// </summary> |
| | 66 | | /// <exception cref="ValidationException"> |
| | 67 | | /// Thrown if validation fails |
| | 68 | | /// </exception> |
| | 69 | | public override void Validate() |
| | 70 | | { |
| 4 | 71 | | base.Validate(); |
| 4 | 72 | | if (Length > 300) |
| | 73 | | { |
| 0 | 74 | | throw new ValidationException(ValidationRules.InclusiveMaximum, "Length", 300); |
| | 75 | | } |
| 4 | 76 | | } |
| | 77 | | } |
| | 78 | | } |