public SemanticConfiguration(string name, PrioritizedFields prioritizedFields)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (prioritizedFields == null)
            {
                throw new ArgumentNullException(nameof(prioritizedFields));
            }

            Name = name;
            PrioritizedFields = prioritizedFields;
        }
Exemple #2
0
        internal static SemanticConfiguration DeserializeSemanticConfiguration(JsonElement element)
        {
            string            name = default;
            PrioritizedFields prioritizedFields = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("prioritizedFields"))
                {
                    prioritizedFields = PrioritizedFields.DeserializePrioritizedFields(property.Value);
                    continue;
                }
            }
            return(new SemanticConfiguration(name, prioritizedFields));
        }