internal static NGramTokenizer DeserializeNGramTokenizer(JsonElement element) { NGramTokenizer result = new NGramTokenizer(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("minGram")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result.MinGram = property.Value.GetInt32(); continue; } if (property.NameEquals("maxGram")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result.MaxGram = property.Value.GetInt32(); continue; } if (property.NameEquals("tokenChars")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result.TokenChars = new List <TokenCharacterKind>(); foreach (var item in property.Value.EnumerateArray()) { result.TokenChars.Add(item.GetString().ToTokenCharacterKind()); } continue; } if (property.NameEquals("@odata.type")) { result.ODataType = property.Value.GetString(); continue; } if (property.NameEquals("name")) { result.Name = property.Value.GetString(); continue; } } return(result); }
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)); }