internal static LexicalTokenizer DeserializeLexicalTokenizer(JsonElement element) { if (element.TryGetProperty("@odata.type", out JsonElement discriminator)) { switch (discriminator.GetString()) { case "#Microsoft.Azure.Search.ClassicTokenizer": return(ClassicTokenizer.DeserializeClassicTokenizer(element)); case "#Microsoft.Azure.Search.EdgeNGramTokenizer": return(EdgeNGramTokenizer.DeserializeEdgeNGramTokenizer(element)); case "#Microsoft.Azure.Search.KeywordTokenizer": return(KeywordTokenizer.DeserializeKeywordTokenizer(element)); case "#Microsoft.Azure.Search.KeywordTokenizerV2": return(KeywordTokenizerV2.DeserializeKeywordTokenizerV2(element)); case "#Microsoft.Azure.Search.MicrosoftLanguageStemmingTokenizer": return(MicrosoftLanguageStemmingTokenizer.DeserializeMicrosoftLanguageStemmingTokenizer(element)); case "#Microsoft.Azure.Search.MicrosoftLanguageTokenizer": return(MicrosoftLanguageTokenizer.DeserializeMicrosoftLanguageTokenizer(element)); case "#Microsoft.Azure.Search.NGramTokenizer": return(NGramTokenizer.DeserializeNGramTokenizer(element)); case "#Microsoft.Azure.Search.PathHierarchyTokenizerV2": return(PathHierarchyTokenizerV2.DeserializePathHierarchyTokenizerV2(element)); case "#Microsoft.Azure.Search.PatternTokenizer": return(PatternTokenizer.DeserializePatternTokenizer(element)); case "#Microsoft.Azure.Search.StandardTokenizer": return(LuceneStandardTokenizer.DeserializeLuceneStandardTokenizer(element)); case "#Microsoft.Azure.Search.StandardTokenizerV2": return(LuceneStandardTokenizerV2.DeserializeLuceneStandardTokenizerV2(element)); case "#Microsoft.Azure.Search.UaxUrlEmailTokenizer": return(UaxUrlEmailTokenizer.DeserializeUaxUrlEmailTokenizer(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 LexicalTokenizer(odataType, name)); }
internal static PathHierarchyTokenizerV2 DeserializePathHierarchyTokenizerV2(JsonElement element) { PathHierarchyTokenizerV2 result = new PathHierarchyTokenizerV2(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("delimiter")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result.Delimiter = property.Value.GetChar(); continue; } if (property.NameEquals("replacement")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result.Replacement = property.Value.GetChar(); continue; } if (property.NameEquals("maxTokenLength")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result.MaxTokenLength = property.Value.GetInt32(); continue; } if (property.NameEquals("reverse")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result.ReverseTokenOrder = property.Value.GetBoolean(); continue; } if (property.NameEquals("skip")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result.NumberOfTokensToSkip = property.Value.GetInt32(); continue; } if (property.NameEquals("@odata.type")) { result.ODataType = property.Value.GetString(); continue; } if (property.NameEquals("name")) { result.Name = property.Value.GetString(); continue; } } return(result); }