{"action":"created","comment":{"url":"https://api.github.com/repos/NuGet/NuGet3/pulls/comments/30095246","id":30095246,"diff_hunk":"@@ -28,98 +28,105 @@ public UISearchResourceV2(IPackageRepository repo)\n \n         public override async Task<IEnumerable<UISearchMetadata>> Search(string searchTerm, SearchFilter filters, int skip, int take, CancellationToken cancellationToken)\n         {\n-            return await GetSearchResultsForVisualStudioUI(searchTerm, filters, skip, take, cancellationToken);\n+            return await GetSearchResultsForVisualStudioUIAsync(searchTerm, filters, skip, take, cancellationToken);\n         }\n \n-        private async Task<IEnumerable<UISearchMetadata>> GetSearchResultsForVisualStudioUI(string searchTerm, SearchFilter filters, int skip, int take, CancellationToken cancellationToken)\n+        private async Task<IEnumerable<UISearchMetadata>> GetSearchResultsForVisualStudioUIAsync(string searchTerm, SearchFilter filters, int skip, int take, CancellationToken cancellationToken)\n         {\n-            return await Task.Run(async () =>\n+            return await Task.Run(() =>\n+            {\n+                var query = V2Client.Search(\n+                    searchTerm,\n+                    filters.SupportedFrameworks,\n+                    filters.IncludePrerelease);\n+\n+                // V2 sometimes requires that we also use an OData filter for \n+                // latest /latest prerelease version\n+                if (filters.IncludePrerelease)\n+                {\n+                    query = query.Where(p => p.IsAbsoluteLatestVersion);\n+                }\n+                else\n+                {\n+                    query = query.Where(p => p.IsLatestVersion);\n+                }\n+                query = query.OrderByDescending(p => p.DownloadCount)\n+                    .ThenBy(p => p.Id);\n+\n+                // Some V2 sources, e.g. NuGet.Server, local repository, the result contains all \n+                // versions of each package. So we need to group the result by Id.\n+                var collapsedQuery = query.AsEnumerable().AsCollapsed();\n+\n+                // execute the query\n+                var allPackages = collapsedQuery\n+                    .Skip(skip)\n+                    .Take(take)\n+                    .ToList();\n+\n+                var results = new List<UISearchMetadata>();\n+\n+                foreach (var package in allPackages)\n                 {\n-                    var query = V2Client.Search(\n-                        searchTerm,\n-                        filters.SupportedFrameworks,\n-                        filters.IncludePrerelease);\n-\n-                    // V2 sometimes requires that we also use an OData filter for \n-                    // latest /latest prerelease version\n-                    if (filters.IncludePrerelease)\n-                    {\n-                        query = query.Where(p => p.IsAbsoluteLatestVersion);\n-                    }\n-                    else\n-                    {\n-                        query = query.Where(p => p.IsLatestVersion);\n-                    }\n-                    query = query.OrderByDescending(p => p.DownloadCount)\n-                        .ThenBy(p => p.Id);\n-\n-                    // Some V2 sources, e.g. NuGet.Server, local repository, the result contains all \n-                    // versions of each package. So we need to group the result by Id.\n-                    var collapsedQuery = query.AsEnumerable().AsCollapsed();\n-\n-                    // execute the query\n-                    var allPackages = collapsedQuery\n-                        .Skip(skip)\n-                        .Take(take)\n-                        .ToList();\n-\n-                    // fetch version info in parallel\n-                    var tasks = new Queue<Task<UISearchMetadata>>();\n-                    foreach (var p in allPackages)\n-                    {\n-                        tasks.Enqueue(CreatePackageSearchResult(p, filters, cancellationToken));\n-                    }\n-\n-                    var results = new List<UISearchMetadata>();\n-                    while (tasks.Count > 0)\n-                    {\n-                        var metadata = await tasks.Dequeue();\n-                        results.Add(metadata);\n-                    }\n-\n-                    return results;\n-                });\n+                    results.Add(CreatePackageSearchResult(package, filters, cancellationToken));\n+                }\n+\n+                return results;\n+            });\n         }\n \n-        private async Task<UISearchMetadata> CreatePackageSearchResult(IPackage package, SearchFilter filters, CancellationToken cancellationToken)\n+        private UISearchMetadata CreatePackageSearchResult(IPackage package, SearchFilter filters, CancellationToken cancellationToken)\n         {\n-            return await Task.Run(() =>\n+            var id = package.Id;\n+            var version = V2Utilities.SafeToNuGetVer(package.Version);\n+            var title = package.Title;\n+            var summary = package.Summary;\n+\n+            if (string.IsNullOrWhiteSpace(summary))\n+            {\n+                summary = package.Description;\n+            }\n+\n+            if (string.IsNullOrEmpty(title))\n+            {\n+                title = id;\n+            }\n+\n+            var iconUrl = package.IconUrl;\n+            var identity = new PackageIdentity(id, version);\n+\n+            var versions = new Lazy<Task<IEnumerable<VersionInfo>>>(() => GetVersionInfoAsync(package, filters, cancellationToken));","path":"src/NuGet.Protocol.VisualStudio/UISearchResourceV2.cs","position":128,"original_position":128,"commit_id":"a22cc17937989f4fb28bff9724c61ddded8e8a83","original_commit_id":"a22cc17937989f4fb28bff9724c61ddded8e8a83","user":{"login":"yishaigalatzer","id":1238711,"avatar_url":"https://avatars.githubusercontent.com/u/1238711?v=3","gravatar_id":"","url":"https://api.github.com/users/yishaigalatzer","html_url":"https://github.com/yishaigalatzer","followers_url":"https://api.github.com/users/yishaigalatzer/followers","following_url":"https://api.github.com/users/yishaigalatzer/following{/other_user}","gists_url":"https://api.github.com/users/yishaigalatzer/gists{/gist_id}","starred_url":"https://api.github.com/users/yishaigalatzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yishaigalatzer/subscriptions","organizations_url":"https://api.github.com/users/yishaigalatzer/orgs","repos_url":"https://api.github.com/users/yishaigalatzer/repos","events_url":"https://api.github.com/users/yishaigalatzer/events{/privacy}","received_events_url":"https://api.github.com/users/yishaigalatzer/received_events","type":"User","site_admin":false},"body":"line length","created_at":"2015-05-12T00:18:20Z","updated_at":"2015-05-12T00:18:20Z","html_url":"https://github.com/NuGet/NuGet3/pull/25#discussion_r30095246","pull_request_url":"https://api.github.com/repos/NuGet/NuGet3/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/NuGet/NuGet3/pulls/comments/30095246"},"html":{"href":"https://github.com/NuGet/NuGet3/pull/25#discussion_r30095246"},"pull_request":{"href":"https://api.github.com/repos/NuGet/NuGet3/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/NuGet/NuGet3/pulls/25","id":35182765,"html_url":"https://github.com/NuGet/NuGet3/pull/25","diff_url":"https://github.com/NuGet/NuGet3/pull/25.diff","patch_url":"https://github.com/NuGet/NuGet3/pull/25.patch","issue_url":"https://api.github.com/repos/NuGet/NuGet3/issues/25","number":25,"state":"open","locked":false,"title":"Make versions load async","user":{"login":"yishaigalatzer","id":1238711,"avatar_url":"https://avatars.githubusercontent.com/u/1238711?v=3","gravatar_id":"","url":"https://api.github.com/users/yishaigalatzer","html_url":"https://github.com/yishaigalatzer","followers_url":"https://api.github.com/users/yishaigalatzer/followers","following_url":"https://api.github.com/users/yishaigalatzer/following{/other_user}","gists_url":"https://api.github.com/users/yishaigalatzer/gists{/gist_id}","starred_url":"https://api.github.com/users/yishaigalatzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yishaigalatzer/subscriptions","organizations_url":"https://api.github.com/users/yishaigalatzer/orgs","repos_url":"https://api.github.com/users/yishaigalatzer/repos","events_url":"https://api.github.com/users/yishaigalatzer/events{/privacy}","received_events_url":"https://api.github.com/users/yishaigalatzer/received_events","type":"User","site_admin":false},"body":"This is an initial change to make version queries happen in a delayed manner.\r\n\r\nIt also adds some refactoring/cleanup along the way.","created_at":"2015-05-12T00:15:13Z","updated_at":"2015-05-12T00:18:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"839c47807c64c4026f19c293b564c4a19922eb04","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/NuGet/NuGet3/pulls/25/commits","review_comments_url":"https://api.github.com/repos/NuGet/NuGet3/pulls/25/comments","review_comment_url":"https://api.github.com/repos/NuGet/NuGet3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NuGet/NuGet3/issues/25/comments","statuses_url":"https://api.github.com/repos/NuGet/NuGet3/statuses/a22cc17937989f4fb28bff9724c61ddded8e8a83","head":{"label":"NuGet:BreakVersionSearchOut","ref":"BreakVersionSearchOut","sha":"a22cc17937989f4fb28bff9724c61ddded8e8a83","user":{"login":"NuGet","id":968310,"avatar_url":"https://avatars.githubusercontent.com/u/968310?v=3","gravatar_id":"","url":"https://api.github.com/users/NuGet","html_url":"https://github.com/NuGet","followers_url":"https://api.github.com/users/NuGet/followers","following_url":"https://api.github.com/users/NuGet/following{/other_user}","gists_url":"https://api.github.com/users/NuGet/gists{/gist_id}","starred_url":"https://api.github.com/users/NuGet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NuGet/subscriptions","organizations_url":"https://api.github.com/users/NuGet/orgs","repos_url":"https://api.github.com/users/NuGet/repos","events_url":"https://api.github.com/users/NuGet/events{/privacy}","received_events_url":"https://api.github.com/users/NuGet/received_events","type":"Organization","site_admin":false},"repo":{"id":31300058,"name":"NuGet3","full_name":"NuGet/NuGet3","owner":{"login":"NuGet","id":968310,"avatar_url":"https://avatars.githubusercontent.com/u/968310?v=3","gravatar_id":"","url":"https://api.github.com/users/NuGet","html_url":"https://github.com/NuGet","followers_url":"https://api.github.com/users/NuGet/followers","following_url":"https://api.github.com/users/NuGet/following{/other_user}","gists_url":"https://api.github.com/users/NuGet/gists{/gist_id}","starred_url":"https://api.github.com/users/NuGet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NuGet/subscriptions","organizations_url":"https://api.github.com/users/NuGet/orgs","repos_url":"https://api.github.com/users/NuGet/repos","events_url":"https://api.github.com/users/NuGet/events{/privacy}","received_events_url":"https://api.github.com/users/NuGet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NuGet/NuGet3","description":"","fork":false,"url":"https://api.github.com/repos/NuGet/NuGet3","forks_url":"https://api.github.com/repos/NuGet/NuGet3/forks","keys_url":"https://api.github.com/repos/NuGet/NuGet3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NuGet/NuGet3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NuGet/NuGet3/teams","hooks_url":"https://api.github.com/repos/NuGet/NuGet3/hooks","issue_events_url":"https://api.github.com/repos/NuGet/NuGet3/issues/events{/number}","events_url":"https://api.github.com/repos/NuGet/NuGet3/events","assignees_url":"https://api.github.com/repos/NuGet/NuGet3/assignees{/user}","branches_url":"https://api.github.com/repos/NuGet/NuGet3/branches{/branch}","tags_url":"https://api.github.com/repos/NuGet/NuGet3/tags","blobs_url":"https://api.github.com/repos/NuGet/NuGet3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NuGet/NuGet3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NuGet/NuGet3/git/refs{/sha}","trees_url":"https://api.github.com/repos/NuGet/NuGet3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NuGet/NuGet3/statuses/{sha}","languages_url":"https://api.github.com/repos/NuGet/NuGet3/languages","stargazers_url":"https://api.github.com/repos/NuGet/NuGet3/stargazers","contributors_url":"https://api.github.com/repos/NuGet/NuGet3/contributors","subscribers_url":"https://api.github.com/repos/NuGet/NuGet3/subscribers","subscription_url":"https://api.github.com/repos/NuGet/NuGet3/subscription","commits_url":"https://api.github.com/repos/NuGet/NuGet3/commits{/sha}","git_commits_url":"https://api.github.com/repos/NuGet/NuGet3/git/commits{/sha}","comments_url":"https://api.github.com/repos/NuGet/NuGet3/comments{/number}","issue_comment_url":"https://api.github.com/repos/NuGet/NuGet3/issues/comments{/number}","contents_url":"https://api.github.com/repos/NuGet/NuGet3/contents/{+path}","compare_url":"https://api.github.com/repos/NuGet/NuGet3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NuGet/NuGet3/merges","archive_url":"https://api.github.com/repos/NuGet/NuGet3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NuGet/NuGet3/downloads","issues_url":"https://api.github.com/repos/NuGet/NuGet3/issues{/number}","pulls_url":"https://api.github.com/repos/NuGet/NuGet3/pulls{/number}","milestones_url":"https://api.github.com/repos/NuGet/NuGet3/milestones{/number}","notifications_url":"https://api.github.com/repos/NuGet/NuGet3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NuGet/NuGet3/labels{/name}","releases_url":"https://api.github.com/repos/NuGet/NuGet3/releases{/id}","created_at":"2015-02-25T06:15:00Z","updated_at":"2015-05-11T21:41:07Z","pushed_at":"2015-05-12T00:15:13Z","git_url":"git://github.com/NuGet/NuGet3.git","ssh_url":"git@github.com:NuGet/NuGet3.git","clone_url":"https://github.com/NuGet/NuGet3.git","svn_url":"https://github.com/NuGet/NuGet3","homepage":null,"size":3335,"stargazers_count":11,"watchers_count":11,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":6,"forks":2,"open_issues":6,"watchers":11,"default_branch":"dev"}},"base":{"label":"NuGet:dev","ref":"dev","sha":"ed34e0cc88b4d63bf8e40cf9377bf3c6e8fc22b4","user":{"login":"NuGet","id":968310,"avatar_url":"https://avatars.githubusercontent.com/u/968310?v=3","gravatar_id":"","url":"https://api.github.com/users/NuGet","html_url":"https://github.com/NuGet","followers_url":"https://api.github.com/users/NuGet/followers","following_url":"https://api.github.com/users/NuGet/following{/other_user}","gists_url":"https://api.github.com/users/NuGet/gists{/gist_id}","starred_url":"https://api.github.com/users/NuGet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NuGet/subscriptions","organizations_url":"https://api.github.com/users/NuGet/orgs","repos_url":"https://api.github.com/users/NuGet/repos","events_url":"https://api.github.com/users/NuGet/events{/privacy}","received_events_url":"https://api.github.com/users/NuGet/received_events","type":"Organization","site_admin":false},"repo":{"id":31300058,"name":"NuGet3","full_name":"NuGet/NuGet3","owner":{"login":"NuGet","id":968310,"avatar_url":"https://avatars.githubusercontent.com/u/968310?v=3","gravatar_id":"","url":"https://api.github.com/users/NuGet","html_url":"https://github.com/NuGet","followers_url":"https://api.github.com/users/NuGet/followers","following_url":"https://api.github.com/users/NuGet/following{/other_user}","gists_url":"https://api.github.com/users/NuGet/gists{/gist_id}","starred_url":"https://api.github.com/users/NuGet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NuGet/subscriptions","organizations_url":"https://api.github.com/users/NuGet/orgs","repos_url":"https://api.github.com/users/NuGet/repos","events_url":"https://api.github.com/users/NuGet/events{/privacy}","received_events_url":"https://api.github.com/users/NuGet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NuGet/NuGet3","description":"","fork":false,"url":"https://api.github.com/repos/NuGet/NuGet3","forks_url":"https://api.github.com/repos/NuGet/NuGet3/forks","keys_url":"https://api.github.com/repos/NuGet/NuGet3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NuGet/NuGet3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NuGet/NuGet3/teams","hooks_url":"https://api.github.com/repos/NuGet/NuGet3/hooks","issue_events_url":"https://api.github.com/repos/NuGet/NuGet3/issues/events{/number}","events_url":"https://api.github.com/repos/NuGet/NuGet3/events","assignees_url":"https://api.github.com/repos/NuGet/NuGet3/assignees{/user}","branches_url":"https://api.github.com/repos/NuGet/NuGet3/branches{/branch}","tags_url":"https://api.github.com/repos/NuGet/NuGet3/tags","blobs_url":"https://api.github.com/repos/NuGet/NuGet3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NuGet/NuGet3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NuGet/NuGet3/git/refs{/sha}","trees_url":"https://api.github.com/repos/NuGet/NuGet3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NuGet/NuGet3/statuses/{sha}","languages_url":"https://api.github.com/repos/NuGet/NuGet3/languages","stargazers_url":"https://api.github.com/repos/NuGet/NuGet3/stargazers","contributors_url":"https://api.github.com/repos/NuGet/NuGet3/contributors","subscribers_url":"https://api.github.com/repos/NuGet/NuGet3/subscribers","subscription_url":"https://api.github.com/repos/NuGet/NuGet3/subscription","commits_url":"https://api.github.com/repos/NuGet/NuGet3/commits{/sha}","git_commits_url":"https://api.github.com/repos/NuGet/NuGet3/git/commits{/sha}","comments_url":"https://api.github.com/repos/NuGet/NuGet3/comments{/number}","issue_comment_url":"https://api.github.com/repos/NuGet/NuGet3/issues/comments{/number}","contents_url":"https://api.github.com/repos/NuGet/NuGet3/contents/{+path}","compare_url":"https://api.github.com/repos/NuGet/NuGet3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NuGet/NuGet3/merges","archive_url":"https://api.github.com/repos/NuGet/NuGet3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NuGet/NuGet3/downloads","issues_url":"https://api.github.com/repos/NuGet/NuGet3/issues{/number}","pulls_url":"https://api.github.com/repos/NuGet/NuGet3/pulls{/number}","milestones_url":"https://api.github.com/repos/NuGet/NuGet3/milestones{/number}","notifications_url":"https://api.github.com/repos/NuGet/NuGet3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NuGet/NuGet3/labels{/name}","releases_url":"https://api.github.com/repos/NuGet/NuGet3/releases{/id}","created_at":"2015-02-25T06:15:00Z","updated_at":"2015-05-11T21:41:07Z","pushed_at":"2015-05-12T00:15:13Z","git_url":"git://github.com/NuGet/NuGet3.git","ssh_url":"git@github.com:NuGet/NuGet3.git","clone_url":"https://github.com/NuGet/NuGet3.git","svn_url":"https://github.com/NuGet/NuGet3","homepage":null,"size":3335,"stargazers_count":11,"watchers_count":11,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":6,"forks":2,"open_issues":6,"watchers":11,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/NuGet/NuGet3/pulls/25"},"html":{"href":"https://github.com/NuGet/NuGet3/pull/25"},"issue":{"href":"https://api.github.com/repos/NuGet/NuGet3/issues/25"},"comments":{"href":"https://api.github.com/repos/NuGet/NuGet3/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/NuGet/NuGet3/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/NuGet/NuGet3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NuGet/NuGet3/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/NuGet/NuGet3/statuses/a22cc17937989f4fb28bff9724c61ddded8e8a83"}}}}