internal CustomAnalyzer(TokenizerName tokenizer, IList <TokenFilterName> tokenFilters, IList <string> charFilters, string oDataType, string name) : base(oDataType, name) { Tokenizer = tokenizer; TokenFilters = tokenFilters; CharFilters = charFilters; ODataType = 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()) { 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(tokenizer, tokenFilters, charFilters, odatatype, name)); }
public CustomAnalyzer(TokenizerName tokenizer, string name) : base(name) { if (name == null) { throw new ArgumentNullException(nameof(name)); } Tokenizer = tokenizer; ODataType = "#Microsoft.Azure.Search.CustomAnalyzer"; }