public async Task <SearchResult <IPackageSearchMetadata> > SearchAsync(string searchText, SearchFilter filter, CancellationToken cancellationToken) { var searchTasks = TaskCombinators.ObserveErrorsAsync( _sourceRepositories, r => r.PackageSource.Name, (r, t) => r.SearchAsync(searchText, filter, PageSize, t), LogError, cancellationToken); return(await WaitForCompletionOrBailOutAsync(searchText, searchTasks, cancellationToken)); }
public async Task <SearchResult <IPackageSearchMetadata> > ContinueSearchAsync(ContinuationToken continuationToken, CancellationToken cancellationToken) { var searchToken = continuationToken as AggregatedContinuationToken; if (searchToken?.SourceSearchCursors == null) { throw new InvalidOperationException("Invalid token"); } var searchTokens = _sourceRepositories .Join(searchToken.SourceSearchCursors, r => r.PackageSource.Name, c => c.Key, (r, c) => new { Repository = r, NextToken = c.Value }); var searchTasks = TaskCombinators.ObserveErrorsAsync( searchTokens, j => j.Repository.PackageSource.Name, (j, t) => j.Repository.SearchAsync(j.NextToken, PageSize, t), LogError, cancellationToken); return(await WaitForCompletionOrBailOutAsync(searchToken.SearchString, searchTasks, cancellationToken)); }