| | 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 StopwordsTokenFilter : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Optional.IsCollectionDefined(Stopwords)) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("stopwords"); |
| 0 | 22 | | writer.WriteStartArray(); |
| 0 | 23 | | foreach (var item in Stopwords) |
| | 24 | | { |
| 0 | 25 | | writer.WriteStringValue(item); |
| | 26 | | } |
| 0 | 27 | | writer.WriteEndArray(); |
| | 28 | | } |
| 0 | 29 | | if (Optional.IsDefined(StopwordsList)) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("stopwordsList"); |
| 0 | 32 | | writer.WriteStringValue(StopwordsList.Value.ToSerialString()); |
| | 33 | | } |
| 0 | 34 | | if (Optional.IsDefined(IgnoreCase)) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("ignoreCase"); |
| 0 | 37 | | writer.WriteBooleanValue(IgnoreCase.Value); |
| | 38 | | } |
| 0 | 39 | | if (Optional.IsDefined(RemoveTrailingStopWords)) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("removeTrailing"); |
| 0 | 42 | | writer.WriteBooleanValue(RemoveTrailingStopWords.Value); |
| | 43 | | } |
| 0 | 44 | | writer.WritePropertyName("@odata.type"); |
| 0 | 45 | | writer.WriteStringValue(ODataType); |
| 0 | 46 | | writer.WritePropertyName("name"); |
| 0 | 47 | | writer.WriteStringValue(Name); |
| 0 | 48 | | writer.WriteEndObject(); |
| 0 | 49 | | } |
| | 50 | |
|
| | 51 | | internal static StopwordsTokenFilter DeserializeStopwordsTokenFilter(JsonElement element) |
| | 52 | | { |
| 0 | 53 | | Optional<IList<string>> stopwords = default; |
| 0 | 54 | | Optional<StopwordsList> stopwordsList = default; |
| 0 | 55 | | Optional<bool> ignoreCase = default; |
| 0 | 56 | | Optional<bool> removeTrailing = default; |
| 0 | 57 | | string odataType = default; |
| 0 | 58 | | string name = default; |
| 0 | 59 | | foreach (var property in element.EnumerateObject()) |
| | 60 | | { |
| 0 | 61 | | if (property.NameEquals("stopwords")) |
| | 62 | | { |
| 0 | 63 | | List<string> array = new List<string>(); |
| 0 | 64 | | foreach (var item in property.Value.EnumerateArray()) |
| | 65 | | { |
| 0 | 66 | | array.Add(item.GetString()); |
| | 67 | | } |
| 0 | 68 | | stopwords = array; |
| 0 | 69 | | continue; |
| | 70 | | } |
| 0 | 71 | | if (property.NameEquals("stopwordsList")) |
| | 72 | | { |
| 0 | 73 | | stopwordsList = property.Value.GetString().ToStopwordsList(); |
| 0 | 74 | | continue; |
| | 75 | | } |
| 0 | 76 | | if (property.NameEquals("ignoreCase")) |
| | 77 | | { |
| 0 | 78 | | ignoreCase = property.Value.GetBoolean(); |
| 0 | 79 | | continue; |
| | 80 | | } |
| 0 | 81 | | if (property.NameEquals("removeTrailing")) |
| | 82 | | { |
| 0 | 83 | | removeTrailing = property.Value.GetBoolean(); |
| 0 | 84 | | continue; |
| | 85 | | } |
| 0 | 86 | | if (property.NameEquals("@odata.type")) |
| | 87 | | { |
| 0 | 88 | | odataType = property.Value.GetString(); |
| 0 | 89 | | continue; |
| | 90 | | } |
| 0 | 91 | | if (property.NameEquals("name")) |
| | 92 | | { |
| 0 | 93 | | name = property.Value.GetString(); |
| | 94 | | continue; |
| | 95 | | } |
| | 96 | | } |
| 0 | 97 | | return new StopwordsTokenFilter(odataType, name, Optional.ToList(stopwords), Optional.ToNullable(stopwordsLi |
| | 98 | | } |
| | 99 | | } |
| | 100 | | } |