| | 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 CjkBigramTokenFilter : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Optional.IsCollectionDefined(IgnoreScripts)) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("ignoreScripts"); |
| 0 | 22 | | writer.WriteStartArray(); |
| 0 | 23 | | foreach (var item in IgnoreScripts) |
| | 24 | | { |
| 0 | 25 | | writer.WriteStringValue(item.ToSerialString()); |
| | 26 | | } |
| 0 | 27 | | writer.WriteEndArray(); |
| | 28 | | } |
| 0 | 29 | | if (Optional.IsDefined(OutputUnigrams)) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("outputUnigrams"); |
| 0 | 32 | | writer.WriteBooleanValue(OutputUnigrams.Value); |
| | 33 | | } |
| 0 | 34 | | writer.WritePropertyName("@odata.type"); |
| 0 | 35 | | writer.WriteStringValue(ODataType); |
| 0 | 36 | | writer.WritePropertyName("name"); |
| 0 | 37 | | writer.WriteStringValue(Name); |
| 0 | 38 | | writer.WriteEndObject(); |
| 0 | 39 | | } |
| | 40 | |
|
| | 41 | | internal static CjkBigramTokenFilter DeserializeCjkBigramTokenFilter(JsonElement element) |
| | 42 | | { |
| 0 | 43 | | Optional<IList<CjkBigramTokenFilterScripts>> ignoreScripts = default; |
| 0 | 44 | | Optional<bool> outputUnigrams = default; |
| 0 | 45 | | string odataType = default; |
| 0 | 46 | | string name = default; |
| 0 | 47 | | foreach (var property in element.EnumerateObject()) |
| | 48 | | { |
| 0 | 49 | | if (property.NameEquals("ignoreScripts")) |
| | 50 | | { |
| 0 | 51 | | List<CjkBigramTokenFilterScripts> array = new List<CjkBigramTokenFilterScripts>(); |
| 0 | 52 | | foreach (var item in property.Value.EnumerateArray()) |
| | 53 | | { |
| 0 | 54 | | array.Add(item.GetString().ToCjkBigramTokenFilterScripts()); |
| | 55 | | } |
| 0 | 56 | | ignoreScripts = array; |
| 0 | 57 | | continue; |
| | 58 | | } |
| 0 | 59 | | if (property.NameEquals("outputUnigrams")) |
| | 60 | | { |
| 0 | 61 | | outputUnigrams = property.Value.GetBoolean(); |
| 0 | 62 | | continue; |
| | 63 | | } |
| 0 | 64 | | if (property.NameEquals("@odata.type")) |
| | 65 | | { |
| 0 | 66 | | odataType = property.Value.GetString(); |
| 0 | 67 | | continue; |
| | 68 | | } |
| 0 | 69 | | if (property.NameEquals("name")) |
| | 70 | | { |
| 0 | 71 | | name = property.Value.GetString(); |
| | 72 | | continue; |
| | 73 | | } |
| | 74 | | } |
| 0 | 75 | | return new CjkBigramTokenFilter(odataType, name, Optional.ToList(ignoreScripts), Optional.ToNullable(outputU |
| | 76 | | } |
| | 77 | | } |
| | 78 | | } |