| | 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 | | /// A character filter that replaces characters in the input string. It |
| | 19 | | /// uses a regular expression to identify character sequences to preserve |
| | 20 | | /// and a replacement pattern to identify characters to replace. For |
| | 21 | | /// example, given the input text "aa bb aa bb", pattern "(aa)\s+(bb)", and |
| | 22 | | /// replacement "$1#$2", the result would be "aa#bb aa#bb". This token |
| | 23 | | /// filter is implemented using Apache Lucene. |
| | 24 | | /// <see |
| | 25 | | /// href="http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/pattern/PatternReplaceFil |
| | 26 | | /// /> |
| | 27 | | /// </summary> |
| | 28 | | [Newtonsoft.Json.JsonObject("#Microsoft.Azure.Search.PatternReplaceTokenFilter")] |
| | 29 | | public partial class PatternReplaceTokenFilter : TokenFilter |
| | 30 | | { |
| | 31 | | /// <summary> |
| | 32 | | /// Initializes a new instance of the PatternReplaceTokenFilter class. |
| | 33 | | /// </summary> |
| 2 | 34 | | public PatternReplaceTokenFilter() |
| | 35 | | { |
| | 36 | | CustomInit(); |
| 2 | 37 | | } |
| | 38 | |
|
| | 39 | | /// <summary> |
| | 40 | | /// Initializes a new instance of the PatternReplaceTokenFilter class. |
| | 41 | | /// </summary> |
| | 42 | | /// <param name="name">The name of the token filter. It must only |
| | 43 | | /// contain letters, digits, spaces, dashes or underscores, can only |
| | 44 | | /// start and end with alphanumeric characters, and is limited to 128 |
| | 45 | | /// characters.</param> |
| | 46 | | /// <param name="pattern">A regular expression pattern.</param> |
| | 47 | | /// <param name="replacement">The replacement text.</param> |
| | 48 | | public PatternReplaceTokenFilter(string name, string pattern, string replacement) |
| 2 | 49 | | : base(name) |
| | 50 | | { |
| 2 | 51 | | Pattern = pattern; |
| 2 | 52 | | Replacement = replacement; |
| | 53 | | CustomInit(); |
| 2 | 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 a regular expression pattern. |
| | 63 | | /// </summary> |
| | 64 | | [JsonProperty(PropertyName = "pattern")] |
| 12 | 65 | | public string Pattern { get; set; } |
| | 66 | |
|
| | 67 | | /// <summary> |
| | 68 | | /// Gets or sets the replacement text. |
| | 69 | | /// </summary> |
| | 70 | | [JsonProperty(PropertyName = "replacement")] |
| 12 | 71 | | public string Replacement { 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 | | { |
| 2 | 81 | | base.Validate(); |
| 2 | 82 | | if (Pattern == null) |
| | 83 | | { |
| 0 | 84 | | throw new ValidationException(ValidationRules.CannotBeNull, "Pattern"); |
| | 85 | | } |
| 2 | 86 | | if (Replacement == null) |
| | 87 | | { |
| 0 | 88 | | throw new ValidationException(ValidationRules.CannotBeNull, "Replacement"); |
| | 89 | | } |
| 2 | 90 | | } |
| | 91 | | } |
| | 92 | | } |