| | 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 | | /// A token filter that only keeps tokens with text contained in a |
| | 21 | | /// specified list of words. This token filter is implemented using Apache |
| | 22 | | /// Lucene. |
| | 23 | | /// <see |
| | 24 | | /// href="http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/miscellaneous/KeepWordFil |
| | 25 | | /// /> |
| | 26 | | /// </summary> |
| | 27 | | [Newtonsoft.Json.JsonObject("#Microsoft.Azure.Search.KeepTokenFilter")] |
| | 28 | | public partial class KeepTokenFilter : TokenFilter |
| | 29 | | { |
| | 30 | | /// <summary> |
| | 31 | | /// Initializes a new instance of the KeepTokenFilter class. |
| | 32 | | /// </summary> |
| 4 | 33 | | public KeepTokenFilter() |
| | 34 | | { |
| | 35 | | CustomInit(); |
| 4 | 36 | | } |
| | 37 | |
|
| | 38 | | /// <summary> |
| | 39 | | /// Initializes a new instance of the KeepTokenFilter class. |
| | 40 | | /// </summary> |
| | 41 | | /// <param name="name">The name of the token filter. It must only |
| | 42 | | /// contain letters, digits, spaces, dashes or underscores, can only |
| | 43 | | /// start and end with alphanumeric characters, and is limited to 128 |
| | 44 | | /// characters.</param> |
| | 45 | | /// <param name="keepWords">The list of words to keep.</param> |
| | 46 | | /// <param name="lowerCaseKeepWords">A value indicating whether to |
| | 47 | | /// lower case all words first. Default is false.</param> |
| | 48 | | public KeepTokenFilter(string name, IList<string> keepWords, bool? lowerCaseKeepWords = default(bool?)) |
| 4 | 49 | | : base(name) |
| | 50 | | { |
| 4 | 51 | | KeepWords = keepWords; |
| 4 | 52 | | LowerCaseKeepWords = lowerCaseKeepWords; |
| | 53 | | CustomInit(); |
| 4 | 54 | | } |
| | 55 | |
|
| | 56 | | /// <summary> |
| | 57 | | /// An initialization method that performs custom operations like setting defaults |
| | 58 | | /// </summary> |
| | 59 | | partial void CustomInit(); |
| | 60 | |
|
| | 61 | | /// <summary> |
| | 62 | | /// Gets or sets the list of words to keep. |
| | 63 | | /// </summary> |
| | 64 | | [JsonProperty(PropertyName = "keepWords")] |
| 24 | 65 | | public IList<string> KeepWords { get; set; } |
| | 66 | |
|
| | 67 | | /// <summary> |
| | 68 | | /// Gets or sets a value indicating whether to lower case all words |
| | 69 | | /// first. Default is false. |
| | 70 | | /// </summary> |
| | 71 | | [JsonProperty(PropertyName = "keepWordsCase")] |
| 20 | 72 | | public bool? LowerCaseKeepWords { get; set; } |
| | 73 | |
|
| | 74 | | /// <summary> |
| | 75 | | /// Validate the object. |
| | 76 | | /// </summary> |
| | 77 | | /// <exception cref="ValidationException"> |
| | 78 | | /// Thrown if validation fails |
| | 79 | | /// </exception> |
| | 80 | | public override void Validate() |
| | 81 | | { |
| 4 | 82 | | base.Validate(); |
| 4 | 83 | | if (KeepWords == null) |
| | 84 | | { |
| 0 | 85 | | throw new ValidationException(ValidationRules.CannotBeNull, "KeepWords"); |
| | 86 | | } |
| 4 | 87 | | } |
| | 88 | | } |
| | 89 | | } |