internal CustomAnalyzer(string odataType, string name, TokenizerName tokenizer, IList <TokenFilterName> tokenFilters, IList <string> charFilters) : base(odataType, name) { Tokenizer = tokenizer; TokenFilters = tokenFilters; CharFilters = charFilters; OdataType = odataType ?? "#Microsoft.Azure.Search.CustomAnalyzer"; }
public CustomAnalyzer(string name, TokenizerName tokenizer) : base(name) { if (name == null) { throw new ArgumentNullException(nameof(name)); } Tokenizer = tokenizer; OdataType = "#Microsoft.Azure.Search.CustomAnalyzer"; }
internal static CustomAnalyzer DeserializeCustomAnalyzer(JsonElement element) { TokenizerName tokenizer = default; IList <TokenFilterName> tokenFilters = default; IList <string> charFilters = default; string odataType = default; string name = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tokenizer")) { tokenizer = new TokenizerName(property.Value.GetString()); continue; } if (property.NameEquals("tokenFilters")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <TokenFilterName> array = new List <TokenFilterName>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(new TokenFilterName(item.GetString())); } tokenFilters = array; continue; } if (property.NameEquals("charFilters")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(item.GetString()); } } charFilters = array; continue; } if (property.NameEquals("@odata.type")) { odataType = property.Value.GetString(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } } return(new CustomAnalyzer(odataType, name, tokenizer, tokenFilters, charFilters)); }