| | 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 | | /// Uses Java regexes to emit multiple tokens - one for each capture group |
| | 21 | | /// in one or more patterns. 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/pattern/PatternCaptureGro |
| | 25 | | /// /> |
| | 26 | | /// </summary> |
| | 27 | | [Newtonsoft.Json.JsonObject("#Microsoft.Azure.Search.PatternCaptureTokenFilter")] |
| | 28 | | public partial class PatternCaptureTokenFilter : TokenFilter |
| | 29 | | { |
| | 30 | | /// <summary> |
| | 31 | | /// Initializes a new instance of the PatternCaptureTokenFilter class. |
| | 32 | | /// </summary> |
| 4 | 33 | | public PatternCaptureTokenFilter() |
| | 34 | | { |
| | 35 | | CustomInit(); |
| 4 | 36 | | } |
| | 37 | |
|
| | 38 | | /// <summary> |
| | 39 | | /// Initializes a new instance of the PatternCaptureTokenFilter 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="patterns">A list of patterns to match against each |
| | 46 | | /// token.</param> |
| | 47 | | /// <param name="preserveOriginal">A value indicating whether to return |
| | 48 | | /// the original token even if one of the patterns matches. Default is |
| | 49 | | /// true.</param> |
| | 50 | | public PatternCaptureTokenFilter(string name, IList<string> patterns, bool? preserveOriginal = default(bool?)) |
| 6 | 51 | | : base(name) |
| | 52 | | { |
| 6 | 53 | | Patterns = patterns; |
| 6 | 54 | | PreserveOriginal = preserveOriginal; |
| | 55 | | CustomInit(); |
| 6 | 56 | | } |
| | 57 | |
|
| | 58 | | /// <summary> |
| | 59 | | /// An initialization method that performs custom operations like setting defaults |
| | 60 | | /// </summary> |
| | 61 | | partial void CustomInit(); |
| | 62 | |
|
| | 63 | | /// <summary> |
| | 64 | | /// Gets or sets a list of patterns to match against each token. |
| | 65 | | /// </summary> |
| | 66 | | [JsonProperty(PropertyName = "patterns")] |
| 26 | 67 | | public IList<string> Patterns { get; set; } |
| | 68 | |
|
| | 69 | | /// <summary> |
| | 70 | | /// Gets or sets a value indicating whether to return the original |
| | 71 | | /// token even if one of the patterns matches. Default is true. |
| | 72 | | /// </summary> |
| | 73 | | [JsonProperty(PropertyName = "preserveOriginal")] |
| 22 | 74 | | public bool? PreserveOriginal { get; set; } |
| | 75 | |
|
| | 76 | | /// <summary> |
| | 77 | | /// Validate the object. |
| | 78 | | /// </summary> |
| | 79 | | /// <exception cref="ValidationException"> |
| | 80 | | /// Thrown if validation fails |
| | 81 | | /// </exception> |
| | 82 | | public override void Validate() |
| | 83 | | { |
| 4 | 84 | | base.Validate(); |
| 4 | 85 | | if (Patterns == null) |
| | 86 | | { |
| 0 | 87 | | throw new ValidationException(ValidationRules.CannotBeNull, "Patterns"); |
| | 88 | | } |
| 4 | 89 | | } |
| | 90 | | } |
| | 91 | | } |