| | 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.Text.Json; |
| | 9 | | using Azure.Core; |
| | 10 | |
|
| | 11 | | namespace Azure.Search.Documents.Indexes.Models |
| | 12 | | { |
| | 13 | | public partial class TokenFilter : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | writer.WritePropertyName("@odata.type"); |
| 0 | 19 | | writer.WriteStringValue(ODataType); |
| 0 | 20 | | writer.WritePropertyName("name"); |
| 0 | 21 | | writer.WriteStringValue(Name); |
| 0 | 22 | | writer.WriteEndObject(); |
| 0 | 23 | | } |
| | 24 | |
|
| | 25 | | internal static TokenFilter DeserializeTokenFilter(JsonElement element) |
| | 26 | | { |
| 4 | 27 | | if (element.TryGetProperty("@odata.type", out JsonElement discriminator)) |
| | 28 | | { |
| 4 | 29 | | switch (discriminator.GetString()) |
| | 30 | | { |
| 0 | 31 | | case "#Microsoft.Azure.Search.AsciiFoldingTokenFilter": return AsciiFoldingTokenFilter.DeserializeAs |
| 0 | 32 | | case "#Microsoft.Azure.Search.CjkBigramTokenFilter": return CjkBigramTokenFilter.DeserializeCjkBigra |
| 0 | 33 | | case "#Microsoft.Azure.Search.CommonGramTokenFilter": return CommonGramTokenFilter.DeserializeCommon |
| 0 | 34 | | case "#Microsoft.Azure.Search.DictionaryDecompounderTokenFilter": return DictionaryDecompounderToken |
| 1 | 35 | | case "#Microsoft.Azure.Search.EdgeNGramTokenFilter": return EdgeNGramTokenFilter.DeserializeEdgeNGra |
| 1 | 36 | | case "#Microsoft.Azure.Search.EdgeNGramTokenFilterV2": return EdgeNGramTokenFilter.DeserializeEdgeNG |
| 0 | 37 | | case "#Microsoft.Azure.Search.ElisionTokenFilter": return ElisionTokenFilter.DeserializeElisionToken |
| 0 | 38 | | case "#Microsoft.Azure.Search.KeepTokenFilter": return KeepTokenFilter.DeserializeKeepTokenFilter(el |
| 0 | 39 | | case "#Microsoft.Azure.Search.KeywordMarkerTokenFilter": return KeywordMarkerTokenFilter.Deserialize |
| 0 | 40 | | case "#Microsoft.Azure.Search.LengthTokenFilter": return LengthTokenFilter.DeserializeLengthTokenFil |
| 0 | 41 | | case "#Microsoft.Azure.Search.LimitTokenFilter": return LimitTokenFilter.DeserializeLimitTokenFilter |
| 1 | 42 | | case "#Microsoft.Azure.Search.NGramTokenFilter": return NGramTokenFilter.DeserializeNGramTokenFilter |
| 1 | 43 | | case "#Microsoft.Azure.Search.NGramTokenFilterV2": return NGramTokenFilter.DeserializeNGramTokenFilt |
| 0 | 44 | | case "#Microsoft.Azure.Search.PatternCaptureTokenFilter": return PatternCaptureTokenFilter.Deseriali |
| 0 | 45 | | case "#Microsoft.Azure.Search.PatternReplaceTokenFilter": return PatternReplaceTokenFilter.Deseriali |
| 0 | 46 | | case "#Microsoft.Azure.Search.PhoneticTokenFilter": return PhoneticTokenFilter.DeserializePhoneticTo |
| 0 | 47 | | case "#Microsoft.Azure.Search.ShingleTokenFilter": return ShingleTokenFilter.DeserializeShingleToken |
| 0 | 48 | | case "#Microsoft.Azure.Search.SnowballTokenFilter": return SnowballTokenFilter.DeserializeSnowballTo |
| 0 | 49 | | case "#Microsoft.Azure.Search.StemmerOverrideTokenFilter": return StemmerOverrideTokenFilter.Deseria |
| 0 | 50 | | case "#Microsoft.Azure.Search.StemmerTokenFilter": return StemmerTokenFilter.DeserializeStemmerToken |
| 0 | 51 | | case "#Microsoft.Azure.Search.StopwordsTokenFilter": return StopwordsTokenFilter.DeserializeStopword |
| 0 | 52 | | case "#Microsoft.Azure.Search.SynonymTokenFilter": return SynonymTokenFilter.DeserializeSynonymToken |
| 0 | 53 | | case "#Microsoft.Azure.Search.TruncateTokenFilter": return TruncateTokenFilter.DeserializeTruncateTo |
| 0 | 54 | | case "#Microsoft.Azure.Search.UniqueTokenFilter": return UniqueTokenFilter.DeserializeUniqueTokenFil |
| 0 | 55 | | case "#Microsoft.Azure.Search.WordDelimiterTokenFilter": return WordDelimiterTokenFilter.Deserialize |
| | 56 | | } |
| | 57 | | } |
| 0 | 58 | | string odataType = default; |
| 0 | 59 | | string name = default; |
| 0 | 60 | | foreach (var property in element.EnumerateObject()) |
| | 61 | | { |
| 0 | 62 | | if (property.NameEquals("@odata.type")) |
| | 63 | | { |
| 0 | 64 | | odataType = property.Value.GetString(); |
| 0 | 65 | | continue; |
| | 66 | | } |
| 0 | 67 | | if (property.NameEquals("name")) |
| | 68 | | { |
| 0 | 69 | | name = property.Value.GetString(); |
| | 70 | | continue; |
| | 71 | | } |
| | 72 | | } |
| 0 | 73 | | return new TokenFilter(odataType, name); |
| | 74 | | } |
| | 75 | | } |
| | 76 | | } |