| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System.Collections.Generic; |
| | 9 | | using System.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.Search.Documents.Indexes.Models |
| | 13 | | { |
| | 14 | | public partial class WordDelimiterTokenFilter : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Optional.IsDefined(GenerateWordParts)) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("generateWordParts"); |
| 0 | 22 | | writer.WriteBooleanValue(GenerateWordParts.Value); |
| | 23 | | } |
| 0 | 24 | | if (Optional.IsDefined(GenerateNumberParts)) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("generateNumberParts"); |
| 0 | 27 | | writer.WriteBooleanValue(GenerateNumberParts.Value); |
| | 28 | | } |
| 0 | 29 | | if (Optional.IsDefined(CatenateWords)) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("catenateWords"); |
| 0 | 32 | | writer.WriteBooleanValue(CatenateWords.Value); |
| | 33 | | } |
| 0 | 34 | | if (Optional.IsDefined(CatenateNumbers)) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("catenateNumbers"); |
| 0 | 37 | | writer.WriteBooleanValue(CatenateNumbers.Value); |
| | 38 | | } |
| 0 | 39 | | if (Optional.IsDefined(CatenateAll)) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("catenateAll"); |
| 0 | 42 | | writer.WriteBooleanValue(CatenateAll.Value); |
| | 43 | | } |
| 0 | 44 | | if (Optional.IsDefined(SplitOnCaseChange)) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("splitOnCaseChange"); |
| 0 | 47 | | writer.WriteBooleanValue(SplitOnCaseChange.Value); |
| | 48 | | } |
| 0 | 49 | | if (Optional.IsDefined(PreserveOriginal)) |
| | 50 | | { |
| 0 | 51 | | writer.WritePropertyName("preserveOriginal"); |
| 0 | 52 | | writer.WriteBooleanValue(PreserveOriginal.Value); |
| | 53 | | } |
| 0 | 54 | | if (Optional.IsDefined(SplitOnNumerics)) |
| | 55 | | { |
| 0 | 56 | | writer.WritePropertyName("splitOnNumerics"); |
| 0 | 57 | | writer.WriteBooleanValue(SplitOnNumerics.Value); |
| | 58 | | } |
| 0 | 59 | | if (Optional.IsDefined(StemEnglishPossessive)) |
| | 60 | | { |
| 0 | 61 | | writer.WritePropertyName("stemEnglishPossessive"); |
| 0 | 62 | | writer.WriteBooleanValue(StemEnglishPossessive.Value); |
| | 63 | | } |
| 0 | 64 | | if (Optional.IsCollectionDefined(ProtectedWords)) |
| | 65 | | { |
| 0 | 66 | | writer.WritePropertyName("protectedWords"); |
| 0 | 67 | | writer.WriteStartArray(); |
| 0 | 68 | | foreach (var item in ProtectedWords) |
| | 69 | | { |
| 0 | 70 | | writer.WriteStringValue(item); |
| | 71 | | } |
| 0 | 72 | | writer.WriteEndArray(); |
| | 73 | | } |
| 0 | 74 | | writer.WritePropertyName("@odata.type"); |
| 0 | 75 | | writer.WriteStringValue(ODataType); |
| 0 | 76 | | writer.WritePropertyName("name"); |
| 0 | 77 | | writer.WriteStringValue(Name); |
| 0 | 78 | | writer.WriteEndObject(); |
| 0 | 79 | | } |
| | 80 | |
|
| | 81 | | internal static WordDelimiterTokenFilter DeserializeWordDelimiterTokenFilter(JsonElement element) |
| | 82 | | { |
| 0 | 83 | | Optional<bool> generateWordParts = default; |
| 0 | 84 | | Optional<bool> generateNumberParts = default; |
| 0 | 85 | | Optional<bool> catenateWords = default; |
| 0 | 86 | | Optional<bool> catenateNumbers = default; |
| 0 | 87 | | Optional<bool> catenateAll = default; |
| 0 | 88 | | Optional<bool> splitOnCaseChange = default; |
| 0 | 89 | | Optional<bool> preserveOriginal = default; |
| 0 | 90 | | Optional<bool> splitOnNumerics = default; |
| 0 | 91 | | Optional<bool> stemEnglishPossessive = default; |
| 0 | 92 | | Optional<IList<string>> protectedWords = default; |
| 0 | 93 | | string odataType = default; |
| 0 | 94 | | string name = default; |
| 0 | 95 | | foreach (var property in element.EnumerateObject()) |
| | 96 | | { |
| 0 | 97 | | if (property.NameEquals("generateWordParts")) |
| | 98 | | { |
| 0 | 99 | | generateWordParts = property.Value.GetBoolean(); |
| 0 | 100 | | continue; |
| | 101 | | } |
| 0 | 102 | | if (property.NameEquals("generateNumberParts")) |
| | 103 | | { |
| 0 | 104 | | generateNumberParts = property.Value.GetBoolean(); |
| 0 | 105 | | continue; |
| | 106 | | } |
| 0 | 107 | | if (property.NameEquals("catenateWords")) |
| | 108 | | { |
| 0 | 109 | | catenateWords = property.Value.GetBoolean(); |
| 0 | 110 | | continue; |
| | 111 | | } |
| 0 | 112 | | if (property.NameEquals("catenateNumbers")) |
| | 113 | | { |
| 0 | 114 | | catenateNumbers = property.Value.GetBoolean(); |
| 0 | 115 | | continue; |
| | 116 | | } |
| 0 | 117 | | if (property.NameEquals("catenateAll")) |
| | 118 | | { |
| 0 | 119 | | catenateAll = property.Value.GetBoolean(); |
| 0 | 120 | | continue; |
| | 121 | | } |
| 0 | 122 | | if (property.NameEquals("splitOnCaseChange")) |
| | 123 | | { |
| 0 | 124 | | splitOnCaseChange = property.Value.GetBoolean(); |
| 0 | 125 | | continue; |
| | 126 | | } |
| 0 | 127 | | if (property.NameEquals("preserveOriginal")) |
| | 128 | | { |
| 0 | 129 | | preserveOriginal = property.Value.GetBoolean(); |
| 0 | 130 | | continue; |
| | 131 | | } |
| 0 | 132 | | if (property.NameEquals("splitOnNumerics")) |
| | 133 | | { |
| 0 | 134 | | splitOnNumerics = property.Value.GetBoolean(); |
| 0 | 135 | | continue; |
| | 136 | | } |
| 0 | 137 | | if (property.NameEquals("stemEnglishPossessive")) |
| | 138 | | { |
| 0 | 139 | | stemEnglishPossessive = property.Value.GetBoolean(); |
| 0 | 140 | | continue; |
| | 141 | | } |
| 0 | 142 | | if (property.NameEquals("protectedWords")) |
| | 143 | | { |
| 0 | 144 | | List<string> array = new List<string>(); |
| 0 | 145 | | foreach (var item in property.Value.EnumerateArray()) |
| | 146 | | { |
| 0 | 147 | | array.Add(item.GetString()); |
| | 148 | | } |
| 0 | 149 | | protectedWords = array; |
| 0 | 150 | | continue; |
| | 151 | | } |
| 0 | 152 | | if (property.NameEquals("@odata.type")) |
| | 153 | | { |
| 0 | 154 | | odataType = property.Value.GetString(); |
| 0 | 155 | | continue; |
| | 156 | | } |
| 0 | 157 | | if (property.NameEquals("name")) |
| | 158 | | { |
| 0 | 159 | | name = property.Value.GetString(); |
| | 160 | | continue; |
| | 161 | | } |
| | 162 | | } |
| 0 | 163 | | return new WordDelimiterTokenFilter(odataType, name, Optional.ToNullable(generateWordParts), Optional.ToNull |
| | 164 | | } |
| | 165 | | } |
| | 166 | | } |