Ejemplo n.º 1
0
        public async ValueTask <SearchResultContextInfo> ContinueSearchAsync(CancellationToken cancellationToken)
        {
            Assumes.NotNull(_lastMainFeedSearchResult);
            Assumes.NotNull(_lastSearchFilter);

            if (_lastMainFeedSearchResult.NextToken == null)
            {
                return(new SearchResultContextInfo(_lastMainFeedSearchResult.OperationId));
            }

            SearchResult <IPackageSearchMetadata> continueSearchResult = await _mainFeed.ContinueSearchAsync(
                _lastMainFeedSearchResult.NextToken,
                cancellationToken);

            _lastMainFeedSearchResult = continueSearchResult;

            var packageItems = new List <PackageSearchMetadataContextInfo>(_lastMainFeedSearchResult.Items.Count);

            foreach (IPackageSearchMetadata packageSearchMetadata in _lastMainFeedSearchResult.Items)
            {
                CacheBackgroundData(packageSearchMetadata, _lastSearchFilter.IncludePrerelease);
                packageItems.Add(PackageSearchMetadataContextInfo.Create(packageSearchMetadata));
            }

            return(new SearchResultContextInfo(
                       packageItems,
                       continueSearchResult.SourceSearchStatus.ToImmutableDictionary(),
                       continueSearchResult.NextToken != null,
                       _lastMainFeedSearchResult.OperationId));
        }
Ejemplo n.º 2
0
        private async Task <SearchResult <IPackageSearchMetadata> > SearchAsync(ContinuationToken continuationToken, CancellationToken cancellationToken)
        {
            if (continuationToken != null)
            {
                return(await _packageFeed.ContinueSearchAsync(continuationToken, cancellationToken));
            }

            return(await _packageFeed.SearchAsync(_searchText, SearchFilter, cancellationToken));
        }
Ejemplo n.º 3
0
        public async Task <SearchResult <IPackageSearchMetadata> > SearchAsync(ContinuationToken continuationToken, CancellationToken cancellationToken)
        {
            await TaskScheduler.Default;

            if (continuationToken != null)
            {
                // only continue search for the search package feed, not the recommender.
                _recommendedCount = 0;
                return(await _packageFeed.ContinueSearchAsync(continuationToken, cancellationToken));
            }

            // get the results of both the recommender package feed and the search/browse feed.
            return(await CombineSearchAsync(cancellationToken));
        }
Ejemplo n.º 4
0
        public async Task <SearchResult <IPackageSearchMetadata> > SearchAsync(ContinuationToken continuationToken, CancellationToken cancellationToken)
        {
            // check if there is already a running initialization task for SolutionManager. If yes,
            // search should wait until this is completed. This would usually happen when opening manager
            //ui is the first nuget operation under LSL mode where it might take some time to initialize.
            if (_context.SolutionManager.InitializationTask != null && !_context.SolutionManager.InitializationTask.IsCompleted)
            {
                await _context.SolutionManager.InitializationTask;
            }

            if (continuationToken != null)
            {
                return(await _packageFeed.ContinueSearchAsync(continuationToken, cancellationToken));
            }

            return(await _packageFeed.SearchAsync(_searchText, SearchFilter, cancellationToken));
        }
Ejemplo n.º 5
0
        public async Task <SearchResult <IPackageSearchMetadata> > SearchAsync(ContinuationToken continuationToken, CancellationToken cancellationToken)
        {
            await TaskScheduler.Default;

            // check if there is already a running initialization task for SolutionManager. If yes,
            // search should wait until this is completed. This would usually happen when opening manager
            //ui is the first nuget operation under LSL mode where it might take some time to initialize.
            if (_context.SolutionManager.InitializationTask != null && !_context.SolutionManager.InitializationTask.IsCompleted)
            {
                await _context.SolutionManager.InitializationTask;
            }

            if (continuationToken != null)
            {
                // only continue search for the search package feed, not the recommender.
                _recommendedCount = 0;
                return(await _packageFeed.ContinueSearchAsync(continuationToken, cancellationToken));
            }

            // get the results of both the recommender package feed and the search/browse feed.
            return(await CombineSearchAsync(cancellationToken));
        }