{"action":"created","comment":{"url":"https://api.github.com/repos/rtfd/readthedocs.org/pulls/comments/201137125","pull_request_review_id":135580540,"id":201137125,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMTEzNzEyNQ==","diff_hunk":"@@ -23,48 +23,48 @@ function attach_elastic_search_query(data) {\n \n         search_url.href = api_host;\n         search_url.pathname = '/api/v2/docsearch/';\n-        search_url.search = '?q=' + $.urlencode(query) + '&project=' + project +\n-            '&version=' + version + '&language=' + language;\n+        search_url.search = '?query=' + $.urlencode(query) + '&project=' + project +\n+                            '&version=' + version + '&language=' + language;\n \n         search_def\n-            .then(function (results) {\n-                var hits = results.hits || {};\n-                var hit_list = hits.hits || [];\n+            .then(function (data) {\n+                var hit_list = data.results || [];\n+                var total_count = data.count || 0;\n \n                 if (hit_list.length) {\n-                    for (var n in hit_list) {\n-                        var hit = hit_list[n];\n-                        var fields = hit.fields || {};\n-                        var list_item = $('<li style=\"display: none;\"></li>');\n-                        var item_url = document.createElement('a');\n-                        var highlight = hit.highlight;\n-\n-                        item_url.href += fields.link +\n-                            DOCUMENTATION_OPTIONS.FILE_SUFFIX;\n-                        item_url.search = '?highlight=' + $.urlencode(query);\n-\n-                        // Result list elements\n-                        list_item.append(\n-                            $('<a />')\n-                            .attr('href', item_url)\n-                            .html(fields.title)\n-                        );\n-                        // fields.project is returned as an array\n-                        if (fields.project.indexOf(project) === -1) {\n-                            list_item.append(\n-                                $('<span>')\n-                                .text(\" (from project \" + fields.project + \")\")\n-                            );\n+                    for (var i = 0; i < hit_list.length; i += 1) {\n+                        var doc = hit_list[i];\n+                        var highlight = doc.highlight;\n+                        var $list_item = $('<li style=\"display: none;\"></li>');\n+\n+                        // Creating the result from elements\n+                        var link = doc.link + DOCUMENTATION_OPTIONS.FILE_SUFFIX +\n+                                   '?highlight=' + $.urlencode(query);\n+\n+                        var $item = $('<a>', {'href': link});\n+                        $item.html(doc.title);\n+                        $list_item.append($item);\n+\n+                        // If the document is from subproject, add extra information\n+                        if (doc.project !== project) {","path":"readthedocs/core/static-src/core/js/doc-embed/search.js","position":55,"original_position":55,"commit_id":"1fa4db617eefecedc59192ca95c05b382a838c84","original_commit_id":"1fa4db617eefecedc59192ca95c05b382a838c84","user":{"login":"safwanrahman","id":7114151,"node_id":"MDQ6VXNlcjcxMTQxNTE=","avatar_url":"https://avatars0.githubusercontent.com/u/7114151?v=4","gravatar_id":"","url":"https://api.github.com/users/safwanrahman","html_url":"https://github.com/safwanrahman","followers_url":"https://api.github.com/users/safwanrahman/followers","following_url":"https://api.github.com/users/safwanrahman/following{/other_user}","gists_url":"https://api.github.com/users/safwanrahman/gists{/gist_id}","starred_url":"https://api.github.com/users/safwanrahman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/safwanrahman/subscriptions","organizations_url":"https://api.github.com/users/safwanrahman/orgs","repos_url":"https://api.github.com/users/safwanrahman/repos","events_url":"https://api.github.com/users/safwanrahman/events{/privacy}","received_events_url":"https://api.github.com/users/safwanrahman/received_events","type":"User","site_admin":false},"body":"As discussed over slack, the new API always return `String`, instead of list.","created_at":"2018-07-09T20:31:43Z","updated_at":"2018-07-09T20:31:44Z","html_url":"https://github.com/rtfd/readthedocs.org/pull/4340#discussion_r201137125","pull_request_url":"https://api.github.com/repos/rtfd/readthedocs.org/pulls/4340","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/rtfd/readthedocs.org/pulls/comments/201137125"},"html":{"href":"https://github.com/rtfd/readthedocs.org/pull/4340#discussion_r201137125"},"pull_request":{"href":"https://api.github.com/repos/rtfd/readthedocs.org/pulls/4340"}},"in_reply_to_id":201071958},"pull_request":{"url":"https://api.github.com/repos/rtfd/readthedocs.org/pulls/4340","id":199962394,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5OTYyMzk0","html_url":"https://github.com/rtfd/readthedocs.org/pull/4340","diff_url":"https://github.com/rtfd/readthedocs.org/pull/4340.diff","patch_url":"https://github.com/rtfd/readthedocs.org/pull/4340.patch","issue_url":"https://api.github.com/repos/rtfd/readthedocs.org/issues/4340","number":4340,"state":"open","locked":false,"title":"[Fix #4265] Porting frontend docsearch to work with new API","user":{"login":"safwanrahman","id":7114151,"node_id":"MDQ6VXNlcjcxMTQxNTE=","avatar_url":"https://avatars0.githubusercontent.com/u/7114151?v=4","gravatar_id":"","url":"https://api.github.com/users/safwanrahman","html_url":"https://github.com/safwanrahman","followers_url":"https://api.github.com/users/safwanrahman/followers","following_url":"https://api.github.com/users/safwanrahman/following{/other_user}","gists_url":"https://api.github.com/users/safwanrahman/gists{/gist_id}","starred_url":"https://api.github.com/users/safwanrahman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/safwanrahman/subscriptions","organizations_url":"https://api.github.com/users/safwanrahman/orgs","repos_url":"https://api.github.com/users/safwanrahman/repos","events_url":"https://api.github.com/users/safwanrahman/events{/privacy}","received_events_url":"https://api.github.com/users/safwanrahman/received_events","type":"User","site_admin":false},"body":"This fixes #4265 \r\nI have ported the existing search javascript in order to work with the new Restful search API. The API   has been implemented in #4309.\r\n\r\n@ericholscher @davidfischer r?","created_at":"2018-07-08T21:46:48Z","updated_at":"2018-07-09T20:31:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6ab49f5a24143c2c0e040671fc96c732fca32a69","assignee":{"login":"safwanrahman","id":7114151,"node_id":"MDQ6VXNlcjcxMTQxNTE=","avatar_url":"https://avatars0.githubusercontent.com/u/7114151?v=4","gravatar_id":"","url":"https://api.github.com/users/safwanrahman","html_url":"https://github.com/safwanrahman","followers_url":"https://api.github.com/users/safwanrahman/followers","following_url":"https://api.github.com/users/safwanrahman/following{/other_user}","gists_url":"https://api.github.com/users/safwanrahman/gists{/gist_id}","starred_url":"https://api.github.com/users/safwanrahman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/safwanrahman/subscriptions","organizations_url":"https://api.github.com/users/safwanrahman/orgs","repos_url":"https://api.github.com/users/safwanrahman/repos","events_url":"https://api.github.com/users/safwanrahman/events{/privacy}","received_events_url":"https://api.github.com/users/safwanrahman/received_events","type":"User","site_admin":false},"assignees":[{"login":"safwanrahman","id":7114151,"node_id":"MDQ6VXNlcjcxMTQxNTE=","avatar_url":"https://avatars0.githubusercontent.com/u/7114151?v=4","gravatar_id":"","url":"https://api.github.com/users/safwanrahman","html_url":"https://github.com/safwanrahman","followers_url":"https://api.github.com/users/safwanrahman/followers","following_url":"https://api.github.com/users/safwanrahman/following{/other_user}","gists_url":"https://api.github.com/users/safwanrahman/gists{/gist_id}","starred_url":"https://api.github.com/users/safwanrahman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/safwanrahman/subscriptions","organizations_url":"https://api.github.com/users/safwanrahman/orgs","repos_url":"https://api.github.com/users/safwanrahman/repos","events_url":"https://api.github.com/users/safwanrahman/events{/privacy}","received_events_url":"https://api.github.com/users/safwanrahman/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rtfd/readthedocs.org/pulls/4340/commits","review_comments_url":"https://api.github.com/repos/rtfd/readthedocs.org/pulls/4340/comments","review_comment_url":"https://api.github.com/repos/rtfd/readthedocs.org/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rtfd/readthedocs.org/issues/4340/comments","statuses_url":"https://api.github.com/repos/rtfd/readthedocs.org/statuses/1fa4db617eefecedc59192ca95c05b382a838c84","head":{"label":"safwanrahman:docsearch","ref":"docsearch","sha":"1fa4db617eefecedc59192ca95c05b382a838c84","user":{"login":"safwanrahman","id":7114151,"node_id":"MDQ6VXNlcjcxMTQxNTE=","avatar_url":"https://avatars0.githubusercontent.com/u/7114151?v=4","gravatar_id":"","url":"https://api.github.com/users/safwanrahman","html_url":"https://github.com/safwanrahman","followers_url":"https://api.github.com/users/safwanrahman/followers","following_url":"https://api.github.com/users/safwanrahman/following{/other_user}","gists_url":"https://api.github.com/users/safwanrahman/gists{/gist_id}","starred_url":"https://api.github.com/users/safwanrahman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/safwanrahman/subscriptions","organizations_url":"https://api.github.com/users/safwanrahman/orgs","repos_url":"https://api.github.com/users/safwanrahman/repos","events_url":"https://api.github.com/users/safwanrahman/events{/privacy}","received_events_url":"https://api.github.com/users/safwanrahman/received_events","type":"User","site_admin":false},"repo":{"id":101502521,"node_id":"MDEwOlJlcG9zaXRvcnkxMDE1MDI1MjE=","name":"readthedocs.org","full_name":"safwanrahman/readthedocs.org","owner":{"login":"safwanrahman","id":7114151,"node_id":"MDQ6VXNlcjcxMTQxNTE=","avatar_url":"https://avatars0.githubusercontent.com/u/7114151?v=4","gravatar_id":"","url":"https://api.github.com/users/safwanrahman","html_url":"https://github.com/safwanrahman","followers_url":"https://api.github.com/users/safwanrahman/followers","following_url":"https://api.github.com/users/safwanrahman/following{/other_user}","gists_url":"https://api.github.com/users/safwanrahman/gists{/gist_id}","starred_url":"https://api.github.com/users/safwanrahman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/safwanrahman/subscriptions","organizations_url":"https://api.github.com/users/safwanrahman/orgs","repos_url":"https://api.github.com/users/safwanrahman/repos","events_url":"https://api.github.com/users/safwanrahman/events{/privacy}","received_events_url":"https://api.github.com/users/safwanrahman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/safwanrahman/readthedocs.org","description":"source code to readthedocs.org","fork":true,"url":"https://api.github.com/repos/safwanrahman/readthedocs.org","forks_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/forks","keys_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/teams","hooks_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/hooks","issue_events_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/issues/events{/number}","events_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/events","assignees_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/assignees{/user}","branches_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/branches{/branch}","tags_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/tags","blobs_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/statuses/{sha}","languages_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/languages","stargazers_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/stargazers","contributors_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/contributors","subscribers_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/subscribers","subscription_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/subscription","commits_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/contents/{+path}","compare_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/merges","archive_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/downloads","issues_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/issues{/number}","pulls_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/pulls{/number}","milestones_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/milestones{/number}","notifications_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/labels{/name}","releases_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/releases{/id}","deployments_url":"https://api.github.com/repos/safwanrahman/readthedocs.org/deployments","created_at":"2017-08-26T17:42:54Z","updated_at":"2018-06-07T16:06:06Z","pushed_at":"2018-07-09T13:05:50Z","git_url":"git://github.com/safwanrahman/readthedocs.org.git","ssh_url":"git@github.com:safwanrahman/readthedocs.org.git","clone_url":"https://github.com/safwanrahman/readthedocs.org.git","svn_url":"https://github.com/safwanrahman/readthedocs.org","homepage":"http://rtfd.org/","size":47989,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rtfd:search_upgrade","ref":"search_upgrade","sha":"d6638b9425c651926810c58306b50cf4143348cc","user":{"login":"rtfd","id":366329,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NjMyOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/366329?v=4","gravatar_id":"","url":"https://api.github.com/users/rtfd","html_url":"https://github.com/rtfd","followers_url":"https://api.github.com/users/rtfd/followers","following_url":"https://api.github.com/users/rtfd/following{/other_user}","gists_url":"https://api.github.com/users/rtfd/gists{/gist_id}","starred_url":"https://api.github.com/users/rtfd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtfd/subscriptions","organizations_url":"https://api.github.com/users/rtfd/orgs","repos_url":"https://api.github.com/users/rtfd/repos","events_url":"https://api.github.com/users/rtfd/events{/privacy}","received_events_url":"https://api.github.com/users/rtfd/received_events","type":"Organization","site_admin":false},"repo":{"id":841835,"node_id":"MDEwOlJlcG9zaXRvcnk4NDE4MzU=","name":"readthedocs.org","full_name":"rtfd/readthedocs.org","owner":{"login":"rtfd","id":366329,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NjMyOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/366329?v=4","gravatar_id":"","url":"https://api.github.com/users/rtfd","html_url":"https://github.com/rtfd","followers_url":"https://api.github.com/users/rtfd/followers","following_url":"https://api.github.com/users/rtfd/following{/other_user}","gists_url":"https://api.github.com/users/rtfd/gists{/gist_id}","starred_url":"https://api.github.com/users/rtfd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtfd/subscriptions","organizations_url":"https://api.github.com/users/rtfd/orgs","repos_url":"https://api.github.com/users/rtfd/repos","events_url":"https://api.github.com/users/rtfd/events{/privacy}","received_events_url":"https://api.github.com/users/rtfd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rtfd/readthedocs.org","description":"The source code that powers readthedocs.org","fork":false,"url":"https://api.github.com/repos/rtfd/readthedocs.org","forks_url":"https://api.github.com/repos/rtfd/readthedocs.org/forks","keys_url":"https://api.github.com/repos/rtfd/readthedocs.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rtfd/readthedocs.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rtfd/readthedocs.org/teams","hooks_url":"https://api.github.com/repos/rtfd/readthedocs.org/hooks","issue_events_url":"https://api.github.com/repos/rtfd/readthedocs.org/issues/events{/number}","events_url":"https://api.github.com/repos/rtfd/readthedocs.org/events","assignees_url":"https://api.github.com/repos/rtfd/readthedocs.org/assignees{/user}","branches_url":"https://api.github.com/repos/rtfd/readthedocs.org/branches{/branch}","tags_url":"https://api.github.com/repos/rtfd/readthedocs.org/tags","blobs_url":"https://api.github.com/repos/rtfd/readthedocs.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rtfd/readthedocs.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rtfd/readthedocs.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/rtfd/readthedocs.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rtfd/readthedocs.org/statuses/{sha}","languages_url":"https://api.github.com/repos/rtfd/readthedocs.org/languages","stargazers_url":"https://api.github.com/repos/rtfd/readthedocs.org/stargazers","contributors_url":"https://api.github.com/repos/rtfd/readthedocs.org/contributors","subscribers_url":"https://api.github.com/repos/rtfd/readthedocs.org/subscribers","subscription_url":"https://api.github.com/repos/rtfd/readthedocs.org/subscription","commits_url":"https://api.github.com/repos/rtfd/readthedocs.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/rtfd/readthedocs.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/rtfd/readthedocs.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/rtfd/readthedocs.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/rtfd/readthedocs.org/contents/{+path}","compare_url":"https://api.github.com/repos/rtfd/readthedocs.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rtfd/readthedocs.org/merges","archive_url":"https://api.github.com/repos/rtfd/readthedocs.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rtfd/readthedocs.org/downloads","issues_url":"https://api.github.com/repos/rtfd/readthedocs.org/issues{/number}","pulls_url":"https://api.github.com/repos/rtfd/readthedocs.org/pulls{/number}","milestones_url":"https://api.github.com/repos/rtfd/readthedocs.org/milestones{/number}","notifications_url":"https://api.github.com/repos/rtfd/readthedocs.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rtfd/readthedocs.org/labels{/name}","releases_url":"https://api.github.com/repos/rtfd/readthedocs.org/releases{/id}","deployments_url":"https://api.github.com/repos/rtfd/readthedocs.org/deployments","created_at":"2010-08-16T19:18:06Z","updated_at":"2018-07-09T15:40:29Z","pushed_at":"2018-07-09T19:04:40Z","git_url":"git://github.com/rtfd/readthedocs.org.git","ssh_url":"git@github.com:rtfd/readthedocs.org.git","clone_url":"https://github.com/rtfd/readthedocs.org.git","svn_url":"https://github.com/rtfd/readthedocs.org","homepage":"https://readthedocs.org/","size":49847,"stargazers_count":4448,"watchers_count":4448,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2392,"mirror_url":null,"archived":false,"open_issues_count":451,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":2392,"open_issues":451,"watchers":4448,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rtfd/readthedocs.org/pulls/4340"},"html":{"href":"https://github.com/rtfd/readthedocs.org/pull/4340"},"issue":{"href":"https://api.github.com/repos/rtfd/readthedocs.org/issues/4340"},"comments":{"href":"https://api.github.com/repos/rtfd/readthedocs.org/issues/4340/comments"},"review_comments":{"href":"https://api.github.com/repos/rtfd/readthedocs.org/pulls/4340/comments"},"review_comment":{"href":"https://api.github.com/repos/rtfd/readthedocs.org/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rtfd/readthedocs.org/pulls/4340/commits"},"statuses":{"href":"https://api.github.com/repos/rtfd/readthedocs.org/statuses/1fa4db617eefecedc59192ca95c05b382a838c84"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"safwanrahman"}}