internal static TokenFilter DeserializeTokenFilter(JsonElement element) { if (element.TryGetProperty("@odata.type", out JsonElement discriminator)) { switch (discriminator.GetString()) { case "#Microsoft.Azure.Search.AsciiFoldingTokenFilter": return(AsciiFoldingTokenFilter.DeserializeAsciiFoldingTokenFilter(element)); case "#Microsoft.Azure.Search.CjkBigramTokenFilter": return(CjkBigramTokenFilter.DeserializeCjkBigramTokenFilter(element)); case "#Microsoft.Azure.Search.CommonGramTokenFilter": return(CommonGramTokenFilter.DeserializeCommonGramTokenFilter(element)); case "#Microsoft.Azure.Search.DictionaryDecompounderTokenFilter": return(DictionaryDecompounderTokenFilter.DeserializeDictionaryDecompounderTokenFilter(element)); case "#Microsoft.Azure.Search.EdgeNGramTokenFilter": return(EdgeNGramTokenFilter.DeserializeEdgeNGramTokenFilter(element)); case "#Microsoft.Azure.Search.EdgeNGramTokenFilterV2": return(EdgeNGramTokenFilterV2.DeserializeEdgeNGramTokenFilterV2(element)); case "#Microsoft.Azure.Search.ElisionTokenFilter": return(ElisionTokenFilter.DeserializeElisionTokenFilter(element)); case "#Microsoft.Azure.Search.KeepTokenFilter": return(KeepTokenFilter.DeserializeKeepTokenFilter(element)); case "#Microsoft.Azure.Search.KeywordMarkerTokenFilter": return(KeywordMarkerTokenFilter.DeserializeKeywordMarkerTokenFilter(element)); case "#Microsoft.Azure.Search.LengthTokenFilter": return(LengthTokenFilter.DeserializeLengthTokenFilter(element)); case "#Microsoft.Azure.Search.LimitTokenFilter": return(LimitTokenFilter.DeserializeLimitTokenFilter(element)); case "#Microsoft.Azure.Search.NGramTokenFilter": return(NGramTokenFilter.DeserializeNGramTokenFilter(element)); case "#Microsoft.Azure.Search.NGramTokenFilterV2": return(NGramTokenFilterV2.DeserializeNGramTokenFilterV2(element)); case "#Microsoft.Azure.Search.PatternCaptureTokenFilter": return(PatternCaptureTokenFilter.DeserializePatternCaptureTokenFilter(element)); case "#Microsoft.Azure.Search.PatternReplaceTokenFilter": return(PatternReplaceTokenFilter.DeserializePatternReplaceTokenFilter(element)); case "#Microsoft.Azure.Search.PhoneticTokenFilter": return(PhoneticTokenFilter.DeserializePhoneticTokenFilter(element)); case "#Microsoft.Azure.Search.ShingleTokenFilter": return(ShingleTokenFilter.DeserializeShingleTokenFilter(element)); case "#Microsoft.Azure.Search.SnowballTokenFilter": return(SnowballTokenFilter.DeserializeSnowballTokenFilter(element)); case "#Microsoft.Azure.Search.StemmerOverrideTokenFilter": return(StemmerOverrideTokenFilter.DeserializeStemmerOverrideTokenFilter(element)); case "#Microsoft.Azure.Search.StemmerTokenFilter": return(StemmerTokenFilter.DeserializeStemmerTokenFilter(element)); case "#Microsoft.Azure.Search.StopwordsTokenFilter": return(StopwordsTokenFilter.DeserializeStopwordsTokenFilter(element)); case "#Microsoft.Azure.Search.SynonymTokenFilter": return(SynonymTokenFilter.DeserializeSynonymTokenFilter(element)); case "#Microsoft.Azure.Search.TruncateTokenFilter": return(TruncateTokenFilter.DeserializeTruncateTokenFilter(element)); case "#Microsoft.Azure.Search.UniqueTokenFilter": return(UniqueTokenFilter.DeserializeUniqueTokenFilter(element)); case "#Microsoft.Azure.Search.WordDelimiterTokenFilter": return(WordDelimiterTokenFilter.DeserializeWordDelimiterTokenFilter(element)); } } string odataType = default; string name = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("@odata.type")) { odataType = property.Value.GetString(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } } return(new TokenFilter(odataType, name)); }
internal static WordDelimiterTokenFilter DeserializeWordDelimiterTokenFilter(JsonElement element) { WordDelimiterTokenFilter result = new WordDelimiterTokenFilter(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("generateWordParts")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result.GenerateWordParts = property.Value.GetBoolean(); continue; } if (property.NameEquals("generateNumberParts")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result.GenerateNumberParts = property.Value.GetBoolean(); continue; } if (property.NameEquals("catenateWords")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result.CatenateWords = property.Value.GetBoolean(); continue; } if (property.NameEquals("catenateNumbers")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result.CatenateNumbers = property.Value.GetBoolean(); continue; } if (property.NameEquals("catenateAll")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result.CatenateAll = property.Value.GetBoolean(); continue; } if (property.NameEquals("splitOnCaseChange")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result.SplitOnCaseChange = property.Value.GetBoolean(); continue; } if (property.NameEquals("preserveOriginal")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result.PreserveOriginal = property.Value.GetBoolean(); continue; } if (property.NameEquals("splitOnNumerics")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result.SplitOnNumerics = property.Value.GetBoolean(); continue; } if (property.NameEquals("stemEnglishPossessive")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result.StemEnglishPossessive = property.Value.GetBoolean(); continue; } if (property.NameEquals("protectedWords")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result.ProtectedWords = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { result.ProtectedWords.Add(item.GetString()); } continue; } if (property.NameEquals("@odata.type")) { result.ODataType = property.Value.GetString(); continue; } if (property.NameEquals("name")) { result.Name = property.Value.GetString(); continue; } } return(result); }