| | 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 | | /// Creates combinations of tokens as a single token. 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/shingle/ShingleFilter.htm |
| | 22 | | /// /> |
| | 23 | | /// </summary> |
| | 24 | | [Newtonsoft.Json.JsonObject("#Microsoft.Azure.Search.ShingleTokenFilter")] |
| | 25 | | public partial class ShingleTokenFilter : TokenFilter |
| | 26 | | { |
| | 27 | | /// <summary> |
| | 28 | | /// Initializes a new instance of the ShingleTokenFilter class. |
| | 29 | | /// </summary> |
| 4 | 30 | | public ShingleTokenFilter() |
| | 31 | | { |
| | 32 | | CustomInit(); |
| 4 | 33 | | } |
| | 34 | |
|
| | 35 | | /// <summary> |
| | 36 | | /// Initializes a new instance of the ShingleTokenFilter 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="maxShingleSize">The maximum shingle size. Default and |
| | 43 | | /// minimum value is 2.</param> |
| | 44 | | /// <param name="minShingleSize">The minimum shingle size. Default and |
| | 45 | | /// minimum value is 2. Must be less than the value of |
| | 46 | | /// maxShingleSize.</param> |
| | 47 | | /// <param name="outputUnigrams">A value indicating whether the output |
| | 48 | | /// stream will contain the input tokens (unigrams) as well as |
| | 49 | | /// shingles. Default is true.</param> |
| | 50 | | /// <param name="outputUnigramsIfNoShingles">A value indicating whether |
| | 51 | | /// to output unigrams for those times when no shingles are available. |
| | 52 | | /// This property takes precedence when outputUnigrams is set to false. |
| | 53 | | /// Default is false.</param> |
| | 54 | | /// <param name="tokenSeparator">The string to use when joining |
| | 55 | | /// adjacent tokens to form a shingle. Default is a single space (" |
| | 56 | | /// ").</param> |
| | 57 | | /// <param name="filterToken">The string to insert for each position at |
| | 58 | | /// which there is no token. Default is an underscore ("_").</param> |
| | 59 | | public ShingleTokenFilter(string name, int? maxShingleSize = default(int?), int? minShingleSize = default(int?), |
| 6 | 60 | | : base(name) |
| | 61 | | { |
| 6 | 62 | | MaxShingleSize = maxShingleSize; |
| 6 | 63 | | MinShingleSize = minShingleSize; |
| 6 | 64 | | OutputUnigrams = outputUnigrams; |
| 6 | 65 | | OutputUnigramsIfNoShingles = outputUnigramsIfNoShingles; |
| 6 | 66 | | TokenSeparator = tokenSeparator; |
| 6 | 67 | | FilterToken = filterToken; |
| | 68 | | CustomInit(); |
| 6 | 69 | | } |
| | 70 | |
|
| | 71 | | /// <summary> |
| | 72 | | /// An initialization method that performs custom operations like setting defaults |
| | 73 | | /// </summary> |
| | 74 | | partial void CustomInit(); |
| | 75 | |
|
| | 76 | | /// <summary> |
| | 77 | | /// Gets or sets the maximum shingle size. Default and minimum value is |
| | 78 | | /// 2. |
| | 79 | | /// </summary> |
| | 80 | | [JsonProperty(PropertyName = "maxShingleSize")] |
| 26 | 81 | | public int? MaxShingleSize { get; set; } |
| | 82 | |
|
| | 83 | | /// <summary> |
| | 84 | | /// Gets or sets the minimum shingle size. Default and minimum value is |
| | 85 | | /// 2. Must be less than the value of maxShingleSize. |
| | 86 | | /// </summary> |
| | 87 | | [JsonProperty(PropertyName = "minShingleSize")] |
| 26 | 88 | | public int? MinShingleSize { get; set; } |
| | 89 | |
|
| | 90 | | /// <summary> |
| | 91 | | /// Gets or sets a value indicating whether the output stream will |
| | 92 | | /// contain the input tokens (unigrams) as well as shingles. Default is |
| | 93 | | /// true. |
| | 94 | | /// </summary> |
| | 95 | | [JsonProperty(PropertyName = "outputUnigrams")] |
| 22 | 96 | | public bool? OutputUnigrams { get; set; } |
| | 97 | |
|
| | 98 | | /// <summary> |
| | 99 | | /// Gets or sets a value indicating whether to output unigrams for |
| | 100 | | /// those times when no shingles are available. This property takes |
| | 101 | | /// precedence when outputUnigrams is set to false. Default is false. |
| | 102 | | /// </summary> |
| | 103 | | [JsonProperty(PropertyName = "outputUnigramsIfNoShingles")] |
| 22 | 104 | | public bool? OutputUnigramsIfNoShingles { get; set; } |
| | 105 | |
|
| | 106 | | /// <summary> |
| | 107 | | /// Gets or sets the string to use when joining adjacent tokens to form |
| | 108 | | /// a shingle. Default is a single space (" "). |
| | 109 | | /// </summary> |
| | 110 | | [JsonProperty(PropertyName = "tokenSeparator")] |
| 22 | 111 | | public string TokenSeparator { get; set; } |
| | 112 | |
|
| | 113 | | /// <summary> |
| | 114 | | /// Gets or sets the string to insert for each position at which there |
| | 115 | | /// is no token. Default is an underscore ("_"). |
| | 116 | | /// </summary> |
| | 117 | | [JsonProperty(PropertyName = "filterToken")] |
| 22 | 118 | | public string FilterToken { get; set; } |
| | 119 | |
|
| | 120 | | /// <summary> |
| | 121 | | /// Validate the object. |
| | 122 | | /// </summary> |
| | 123 | | /// <exception cref="ValidationException"> |
| | 124 | | /// Thrown if validation fails |
| | 125 | | /// </exception> |
| | 126 | | public override void Validate() |
| | 127 | | { |
| 4 | 128 | | base.Validate(); |
| 4 | 129 | | if (MaxShingleSize < 2) |
| | 130 | | { |
| 0 | 131 | | throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxShingleSize", 2); |
| | 132 | | } |
| 4 | 133 | | if (MinShingleSize < 2) |
| | 134 | | { |
| 0 | 135 | | throw new ValidationException(ValidationRules.InclusiveMinimum, "MinShingleSize", 2); |
| | 136 | | } |
| 4 | 137 | | } |
| | 138 | | } |
| | 139 | | } |