| | 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 DictionaryDecompounderTokenFilter : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | writer.WritePropertyName("wordList"); |
| 0 | 20 | | writer.WriteStartArray(); |
| 0 | 21 | | foreach (var item in WordList) |
| | 22 | | { |
| 0 | 23 | | writer.WriteStringValue(item); |
| | 24 | | } |
| 0 | 25 | | writer.WriteEndArray(); |
| 0 | 26 | | if (Optional.IsDefined(MinWordSize)) |
| | 27 | | { |
| 0 | 28 | | writer.WritePropertyName("minWordSize"); |
| 0 | 29 | | writer.WriteNumberValue(MinWordSize.Value); |
| | 30 | | } |
| 0 | 31 | | if (Optional.IsDefined(MinSubwordSize)) |
| | 32 | | { |
| 0 | 33 | | writer.WritePropertyName("minSubwordSize"); |
| 0 | 34 | | writer.WriteNumberValue(MinSubwordSize.Value); |
| | 35 | | } |
| 0 | 36 | | if (Optional.IsDefined(MaxSubwordSize)) |
| | 37 | | { |
| 0 | 38 | | writer.WritePropertyName("maxSubwordSize"); |
| 0 | 39 | | writer.WriteNumberValue(MaxSubwordSize.Value); |
| | 40 | | } |
| 0 | 41 | | if (Optional.IsDefined(OnlyLongestMatch)) |
| | 42 | | { |
| 0 | 43 | | writer.WritePropertyName("onlyLongestMatch"); |
| 0 | 44 | | writer.WriteBooleanValue(OnlyLongestMatch.Value); |
| | 45 | | } |
| 0 | 46 | | writer.WritePropertyName("@odata.type"); |
| 0 | 47 | | writer.WriteStringValue(ODataType); |
| 0 | 48 | | writer.WritePropertyName("name"); |
| 0 | 49 | | writer.WriteStringValue(Name); |
| 0 | 50 | | writer.WriteEndObject(); |
| 0 | 51 | | } |
| | 52 | |
|
| | 53 | | internal static DictionaryDecompounderTokenFilter DeserializeDictionaryDecompounderTokenFilter(JsonElement eleme |
| | 54 | | { |
| 0 | 55 | | IList<string> wordList = default; |
| 0 | 56 | | Optional<int> minWordSize = default; |
| 0 | 57 | | Optional<int> minSubwordSize = default; |
| 0 | 58 | | Optional<int> maxSubwordSize = default; |
| 0 | 59 | | Optional<bool> onlyLongestMatch = default; |
| 0 | 60 | | string odataType = default; |
| 0 | 61 | | string name = default; |
| 0 | 62 | | foreach (var property in element.EnumerateObject()) |
| | 63 | | { |
| 0 | 64 | | if (property.NameEquals("wordList")) |
| | 65 | | { |
| 0 | 66 | | List<string> array = new List<string>(); |
| 0 | 67 | | foreach (var item in property.Value.EnumerateArray()) |
| | 68 | | { |
| 0 | 69 | | array.Add(item.GetString()); |
| | 70 | | } |
| 0 | 71 | | wordList = array; |
| 0 | 72 | | continue; |
| | 73 | | } |
| 0 | 74 | | if (property.NameEquals("minWordSize")) |
| | 75 | | { |
| 0 | 76 | | minWordSize = property.Value.GetInt32(); |
| 0 | 77 | | continue; |
| | 78 | | } |
| 0 | 79 | | if (property.NameEquals("minSubwordSize")) |
| | 80 | | { |
| 0 | 81 | | minSubwordSize = property.Value.GetInt32(); |
| 0 | 82 | | continue; |
| | 83 | | } |
| 0 | 84 | | if (property.NameEquals("maxSubwordSize")) |
| | 85 | | { |
| 0 | 86 | | maxSubwordSize = property.Value.GetInt32(); |
| 0 | 87 | | continue; |
| | 88 | | } |
| 0 | 89 | | if (property.NameEquals("onlyLongestMatch")) |
| | 90 | | { |
| 0 | 91 | | onlyLongestMatch = property.Value.GetBoolean(); |
| 0 | 92 | | continue; |
| | 93 | | } |
| 0 | 94 | | if (property.NameEquals("@odata.type")) |
| | 95 | | { |
| 0 | 96 | | odataType = property.Value.GetString(); |
| 0 | 97 | | continue; |
| | 98 | | } |
| 0 | 99 | | if (property.NameEquals("name")) |
| | 100 | | { |
| 0 | 101 | | name = property.Value.GetString(); |
| | 102 | | continue; |
| | 103 | | } |
| | 104 | | } |
| 0 | 105 | | return new DictionaryDecompounderTokenFilter(odataType, name, wordList, Optional.ToNullable(minWordSize), Op |
| | 106 | | } |
| | 107 | | } |
| | 108 | | } |