Exemplo n.º 1
0
        /// <inheritdoc />
        public override IEnumerable <Page <SearchResult <T> > > AsPages(string continuationToken = default, int?pageSizeHint = default)
        {
            SearchResults <T> initial = _results; // TODO: #10590 - Add durable continuation tokens

            for (SearchResults <T> results = initial;
                 results != null;
                 results = results.GetNextPageAsync(async: false, CancellationToken).EnsureCompleted())
            {
                yield return(new SearchResultsPage <T>(results));
            }
        }
Exemplo n.º 2
0
        /// <inheritdoc />
        public override async IAsyncEnumerable <Page <SearchResult <T> > > AsPages(string continuationToken = default, int?pageSizeHint = default)
        {
            SearchResults <T> initial = _results; // TODO: #10590 - Add durable continuation tokens

            for (SearchResults <T> results = initial;
                 results != null;
                 results = await results.GetNextPageAsync(async: true, CancellationToken).ConfigureAwait(false))
            {
                yield return(new SearchResultsPage <T>(results));
            }
        }
        /// <inheritdoc />
        public override IEnumerable <Page <SearchResult <T> > > AsPages(string continuationToken = default, int?pageSizeHint = default)
        {
            // The first page of our results is always provided so we can
            // ignore the continuation token.  Users can only provide a token
            // directly to the Search method.
            Debug.Assert(continuationToken == null);

            SearchResults <T> initial = _results;

            for (SearchResults <T> results = initial;
                 results != null;
                 results = results.GetNextPageAsync(async: false, CancellationToken).EnsureCompleted())
            {
                yield return(new SearchResultsPage <T>(results));
            }
        }