< Summary

Class:Azure.Search.Documents.Models.SearchDocumentsResult
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchDocumentsResult.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchDocumentsResult.Serialization.cs
Covered lines:0
Uncovered lines:54
Coverable lines:54
Total lines:139
Line coverage:0% (0 of 54)
Covered branches:0
Total branches:22
Branch coverage:0% (0 of 22)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%100%
get_Count()-0%100%
get_Coverage()-0%100%
get_Facets()-0%100%
get_NextPageParameters()-0%100%
get_Results()-0%100%
get_NextLink()-0%100%
DeserializeSearchDocumentsResult(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchDocumentsResult.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Collections.Generic;
 10using System.Linq;
 11using Azure.Core;
 12using Azure.Search.Documents;
 13
 14namespace Azure.Search.Documents.Models
 15{
 16    /// <summary> Response containing search results from an index. </summary>
 17    internal partial class SearchDocumentsResult
 18    {
 19        /// <summary> Initializes a new instance of SearchDocumentsResult. </summary>
 20        /// <param name="results"> The sequence of results returned by the query. </param>
 21        /// <exception cref="ArgumentNullException"> <paramref name="results"/> is null. </exception>
 022        internal SearchDocumentsResult(IEnumerable<SearchResult> results)
 23        {
 024            if (results == null)
 25            {
 026                throw new ArgumentNullException(nameof(results));
 27            }
 28
 029            Facets = new ChangeTrackingDictionary<string, IList<FacetResult>>();
 030            Results = results.ToList();
 031        }
 32
 33        /// <summary> Initializes a new instance of SearchDocumentsResult. </summary>
 34        /// <param name="count"> The total count of results found by the search operation, or null if the count was not 
 35        /// <param name="coverage"> A value indicating the percentage of the index that was included in the query, or nu
 36        /// <param name="facets"> The facet query results for the search operation, organized as a collection of buckets
 37        /// <param name="nextPageParameters"> Continuation JSON payload returned when Azure Cognitive Search can&apos;t 
 38        /// <param name="results"> The sequence of results returned by the query. </param>
 39        /// <param name="nextLink"> Continuation URL returned when Azure Cognitive Search can&apos;t return all the requ
 040        internal SearchDocumentsResult(long? count, double? coverage, IReadOnlyDictionary<string, IList<FacetResult>> fa
 41        {
 042            Count = count;
 043            Coverage = coverage;
 044            Facets = facets;
 045            NextPageParameters = nextPageParameters;
 046            Results = results;
 047            NextLink = nextLink;
 048        }
 49
 50        /// <summary> The total count of results found by the search operation, or null if the count was not requested. 
 051        public long? Count { get; }
 52        /// <summary> A value indicating the percentage of the index that was included in the query, or null if minimumC
 053        public double? Coverage { get; }
 54        /// <summary> The facet query results for the search operation, organized as a collection of buckets for each fa
 055        public IReadOnlyDictionary<string, IList<FacetResult>> Facets { get; }
 56        /// <summary> Continuation JSON payload returned when Azure Cognitive Search can&apos;t return all the requested
 057        public SearchOptions NextPageParameters { get; }
 58        /// <summary> The sequence of results returned by the query. </summary>
 059        public IReadOnlyList<SearchResult> Results { get; }
 60        /// <summary> Continuation URL returned when Azure Cognitive Search can&apos;t return all the requested results 
 061        public string NextLink { get; }
 62    }
 63}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchDocumentsResult.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11using Azure.Search.Documents;
 12
 13namespace Azure.Search.Documents.Models
 14{
 15    internal partial class SearchDocumentsResult
 16    {
 17        internal static SearchDocumentsResult DeserializeSearchDocumentsResult(JsonElement element)
 18        {
 019            Optional<long> odataCount = default;
 020            Optional<double> searchCoverage = default;
 021            Optional<IReadOnlyDictionary<string, IList<FacetResult>>> searchFacets = default;
 022            Optional<SearchOptions> searchNextPageParameters = default;
 023            IReadOnlyList<SearchResult> value = default;
 024            Optional<string> odataNextLink = default;
 025            foreach (var property in element.EnumerateObject())
 26            {
 027                if (property.NameEquals("@odata.count"))
 28                {
 029                    odataCount = property.Value.GetInt64();
 030                    continue;
 31                }
 032                if (property.NameEquals("@search.coverage"))
 33                {
 034                    searchCoverage = property.Value.GetDouble();
 035                    continue;
 36                }
 037                if (property.NameEquals("@search.facets"))
 38                {
 039                    Dictionary<string, IList<FacetResult>> dictionary = new Dictionary<string, IList<FacetResult>>();
 040                    foreach (var property0 in property.Value.EnumerateObject())
 41                    {
 042                        List<FacetResult> array = new List<FacetResult>();
 043                        foreach (var item in property0.Value.EnumerateArray())
 44                        {
 045                            array.Add(FacetResult.DeserializeFacetResult(item));
 46                        }
 047                        dictionary.Add(property0.Name, array);
 48                    }
 049                    searchFacets = dictionary;
 050                    continue;
 51                }
 052                if (property.NameEquals("@search.nextPageParameters"))
 53                {
 054                    searchNextPageParameters = SearchOptions.DeserializeSearchOptions(property.Value);
 055                    continue;
 56                }
 057                if (property.NameEquals("value"))
 58                {
 059                    List<SearchResult> array = new List<SearchResult>();
 060                    foreach (var item in property.Value.EnumerateArray())
 61                    {
 062                        array.Add(SearchResult.DeserializeSearchResult(item));
 63                    }
 064                    value = array;
 065                    continue;
 66                }
 067                if (property.NameEquals("@odata.nextLink"))
 68                {
 069                    odataNextLink = property.Value.GetString();
 70                    continue;
 71                }
 72            }
 073            return new SearchDocumentsResult(Optional.ToNullable(odataCount), Optional.ToNullable(searchCoverage), Optio
 74        }
 75    }
 76}