internal static SuggestDocumentsResult DeserializeSuggestDocumentsResult(JsonElement element)
        {
            IReadOnlyList <SuggestResult> value = default;
            double?searchcoverage = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    List <SuggestResult> array = new List <SuggestResult>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(SuggestResult.DeserializeSuggestResult(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("@search.coverage"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    searchcoverage = property.Value.GetDouble();
                    continue;
                }
            }
            return(new SuggestDocumentsResult(value, searchcoverage));
        }
Ejemplo n.º 2
0
        internal static SuggestDocumentsResult DeserializeSuggestDocumentsResult(JsonElement element)
        {
            SuggestDocumentsResult result = new SuggestDocumentsResult();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        result.Results.Add(SuggestResult.DeserializeSuggestResult(item));
                    }
                    continue;
                }
                if (property.NameEquals("@search.coverage"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result.Coverage = property.Value.GetDouble();
                    continue;
                }
            }
            return(result);
        }
Ejemplo n.º 3
0
        internal static SuggestResult DeserializeSuggestResult(JsonElement element)
        {
            SuggestResult result = new SuggestResult();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("@search.text"))
                {
                    result.Text = property.Value.GetString();
                    continue;
                }
                result.Add(property.Name, property.Value.GetObject());
            }
            return(result);
        }