{"action":"created","comment":{"url":"https://api.github.com/repos/Wikia/app/pulls/comments/91046118","pull_request_review_id":11555892,"id":91046118,"diff_hunk":"@@ -197,92 +222,100 @@ public function searchAsApi( $fields = null, $metadata = false, $keyField = null\n \t\t\t$numPages = $config->getNumPages();\n \t\t\t$limit = $config->getLimit();\n \t\t\t$response = [\n-\t\t\t\t\t'total' => $total,\n-\t\t\t\t\t'batches' => $total > 0 ? $numPages : 0,\n-\t\t\t\t\t'currentBatch' => $total > 0 ? $config->getPage() : 0,\n-\t\t\t\t\t'next' => 0,\n-\t\t\t\t\t'items' => $resultSet->toArray( $fields, $keyField )\n-\t\t\t\t\t];\n+\t\t\t\t'total' => $total,\n+\t\t\t\t'batches' => $total > 0 ? $numPages : 0,\n+\t\t\t\t'currentBatch' => $total > 0 ? $config->getPage() : 0,\n+\t\t\t\t'next' => 0,\n+\t\t\t\t'items' => $resultSet->toArray( $fields, $keyField )\n+\t\t\t];\n \t\t\tif ( $total > 0 ) {\n-\t\t\t\t$response[ 'next' ] = min( [ $numPages * $limit, $config->getStart() + $limit ] ) +\n-\t\t\t\t\t$config->mustAddMatchedRecords() + 1;\n+\t\t\t\t$response['next'] =\n+\t\t\t\t\tmin( [ $numPages * $limit, $config->getStart() + $limit ] ) + $config->mustAddMatchedRecords() + 1;\n \t\t\t}\n \t\t} else if ( $fields ) {\n \t\t\t$response = $resultSet->toArray( $fields, $keyField );\n \t\t} else {\n \t\t\t$response = $resultSet->toArray( null, $keyField );\n \t\t}\n+\n \t\treturn $response;\n \t}\n-\t\n+\n \t/**\n-\t * Retrieves an existing match, or forces the child class to retrieve a match. \n-\t * @return \\Wikia\\Search\\Match\\Article|\\Wikia\\Search\\Match\\Wiki|\\Wikia\\Search\\false|boolean\n+\t * Retrieves an existing match, or forces the child class to retrieve a match.\n+\t *\n+\t * @return \\Wikia\\Search\\Match\\Article|\\Wikia\\Search\\Match\\Wiki|boolean\n \t */\n \tpublic function getMatch() {\n \t\t$config = $this->getConfig();\n \t\tif ( $config->hasMatch() ) {\n \t\t\treturn $config->getMatch();\n \t\t}\n+\n \t\treturn $this->extractMatch();\n \t}\n-\t\n+\n \t/**\n-\t * This hook should be overidden by children to access the appropriate kind of match.\n-\t * @return NULL\n+\t * This hook should be overridden by children to access the appropriate kind of match.\n+\t *\n+\t * @return null\n \t */\n \tprotected function extractMatch() {\n \t\treturn null;\n \t}\n-\t\n+\n \t/**\n \t * Creates an instance of Solarium_Query_Select configured by searchconfig.\n+\t *\n \t * @return \\Solarium_Query_Select\n \t */\n \tprotected function getSelectQuery() {\n \t\t$query = $this->getClient()->createSelect();\n \t\t$query->setDocumentClass( '\\Wikia\\Search\\Result' );\n-\t\t$this->registerQueryParams( $query )\n-\t\t     ->registerComponents( $query );\n+\t\t$this->registerQueryParams( $query )->registerComponents( $query );\n+\n \t\treturn $query->setQuery( $this->getQuery() );\n \t}\n-\t\n+\n \t/**\n \t * This is abstract because the dismax and lucene query services behave differently here.\n+\t *\n \t * @return string\n \t */\n \tabstract protected function getQuery();\n-\t\n+\n \t/**\n \t * Allows us to configure components in child instances.\n+\t *\n \t * @param \\Solarium_Query_Select $query\n+\t *\n \t * @return \\Wikia\\Search\\QueryService\\Select\\AbstractSelect\n \t */\n \tprotected function registerComponents( Solarium_Query_Select $query ) {","path":"extensions/wikia/Search/classes/QueryService/Select/AbstractSelect.php","position":354,"original_position":354,"commit_id":"5df4f70caee7a6d19de47609357605d3f73e6521","original_commit_id":"5df4f70caee7a6d19de47609357605d3f73e6521","user":{"login":"WikiaTech","id":13279985,"avatar_url":"https://avatars.githubusercontent.com/u/13279985?v=3","gravatar_id":"","url":"https://api.github.com/users/WikiaTech","html_url":"https://github.com/WikiaTech","followers_url":"https://api.github.com/users/WikiaTech/followers","following_url":"https://api.github.com/users/WikiaTech/following{/other_user}","gists_url":"https://api.github.com/users/WikiaTech/gists{/gist_id}","starred_url":"https://api.github.com/users/WikiaTech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WikiaTech/subscriptions","organizations_url":"https://api.github.com/users/WikiaTech/orgs","repos_url":"https://api.github.com/users/WikiaTech/repos","events_url":"https://api.github.com/users/WikiaTech/events{/privacy}","received_events_url":"https://api.github.com/users/WikiaTech/received_events","type":"User","site_admin":false},"body":"![MAJOR](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png) Remove the unused function parameter \"$query\". [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](https://sonarqube.wikia-inc.com/coding_rules#rule_key=php%3AS1172)\n","created_at":"2016-12-06T10:09:04Z","updated_at":"2016-12-06T10:09:04Z","html_url":"https://github.com/Wikia/app/pull/12086#discussion_r91046118","pull_request_url":"https://api.github.com/repos/Wikia/app/pulls/12086","_links":{"self":{"href":"https://api.github.com/repos/Wikia/app/pulls/comments/91046118"},"html":{"href":"https://github.com/Wikia/app/pull/12086#discussion_r91046118"},"pull_request":{"href":"https://api.github.com/repos/Wikia/app/pulls/12086"}}},"pull_request":{"url":"https://api.github.com/repos/Wikia/app/pulls/12086","id":96693998,"html_url":"https://github.com/Wikia/app/pull/12086","diff_url":"https://github.com/Wikia/app/pull/12086.diff","patch_url":"https://github.com/Wikia/app/pull/12086.patch","issue_url":"https://api.github.com/repos/Wikia/app/issues/12086","number":12086,"state":"open","locked":false,"title":"SUS | Cleanup code in Search/QueryService","user":{"login":"hakubo","id":1018759,"avatar_url":"https://avatars.githubusercontent.com/u/1018759?v=3","gravatar_id":"","url":"https://api.github.com/users/hakubo","html_url":"https://github.com/hakubo","followers_url":"https://api.github.com/users/hakubo/followers","following_url":"https://api.github.com/users/hakubo/following{/other_user}","gists_url":"https://api.github.com/users/hakubo/gists{/gist_id}","starred_url":"https://api.github.com/users/hakubo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hakubo/subscriptions","organizations_url":"https://api.github.com/users/hakubo/orgs","repos_url":"https://api.github.com/users/hakubo/repos","events_url":"https://api.github.com/users/hakubo/events{/privacy}","received_events_url":"https://api.github.com/users/hakubo/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-06T10:06:26Z","updated_at":"2016-12-06T10:09:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"81e6ac0e9854a7467eb7427b660f5511f2c3b55e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Wikia/app/pulls/12086/commits","review_comments_url":"https://api.github.com/repos/Wikia/app/pulls/12086/comments","review_comment_url":"https://api.github.com/repos/Wikia/app/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Wikia/app/issues/12086/comments","statuses_url":"https://api.github.com/repos/Wikia/app/statuses/5df4f70caee7a6d19de47609357605d3f73e6521","head":{"label":"Wikia:cleanup-search-6","ref":"cleanup-search-6","sha":"5df4f70caee7a6d19de47609357605d3f73e6521","user":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"repo":{"id":5532313,"name":"app","full_name":"Wikia/app","owner":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Wikia/app","description":"Wikia Application Code","fork":false,"url":"https://api.github.com/repos/Wikia/app","forks_url":"https://api.github.com/repos/Wikia/app/forks","keys_url":"https://api.github.com/repos/Wikia/app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Wikia/app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Wikia/app/teams","hooks_url":"https://api.github.com/repos/Wikia/app/hooks","issue_events_url":"https://api.github.com/repos/Wikia/app/issues/events{/number}","events_url":"https://api.github.com/repos/Wikia/app/events","assignees_url":"https://api.github.com/repos/Wikia/app/assignees{/user}","branches_url":"https://api.github.com/repos/Wikia/app/branches{/branch}","tags_url":"https://api.github.com/repos/Wikia/app/tags","blobs_url":"https://api.github.com/repos/Wikia/app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Wikia/app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Wikia/app/git/refs{/sha}","trees_url":"https://api.github.com/repos/Wikia/app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Wikia/app/statuses/{sha}","languages_url":"https://api.github.com/repos/Wikia/app/languages","stargazers_url":"https://api.github.com/repos/Wikia/app/stargazers","contributors_url":"https://api.github.com/repos/Wikia/app/contributors","subscribers_url":"https://api.github.com/repos/Wikia/app/subscribers","subscription_url":"https://api.github.com/repos/Wikia/app/subscription","commits_url":"https://api.github.com/repos/Wikia/app/commits{/sha}","git_commits_url":"https://api.github.com/repos/Wikia/app/git/commits{/sha}","comments_url":"https://api.github.com/repos/Wikia/app/comments{/number}","issue_comment_url":"https://api.github.com/repos/Wikia/app/issues/comments{/number}","contents_url":"https://api.github.com/repos/Wikia/app/contents/{+path}","compare_url":"https://api.github.com/repos/Wikia/app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Wikia/app/merges","archive_url":"https://api.github.com/repos/Wikia/app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Wikia/app/downloads","issues_url":"https://api.github.com/repos/Wikia/app/issues{/number}","pulls_url":"https://api.github.com/repos/Wikia/app/pulls{/number}","milestones_url":"https://api.github.com/repos/Wikia/app/milestones{/number}","notifications_url":"https://api.github.com/repos/Wikia/app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Wikia/app/labels{/name}","releases_url":"https://api.github.com/repos/Wikia/app/releases{/id}","deployments_url":"https://api.github.com/repos/Wikia/app/deployments","created_at":"2012-08-23T20:55:58Z","updated_at":"2016-12-03T22:51:32Z","pushed_at":"2016-12-06T10:06:26Z","git_url":"git://github.com/Wikia/app.git","ssh_url":"git@github.com:Wikia/app.git","clone_url":"https://github.com/Wikia/app.git","svn_url":"https://github.com/Wikia/app","homepage":"http://dev.wikia.com","size":1494598,"stargazers_count":107,"watchers_count":107,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":85,"mirror_url":null,"open_issues_count":118,"forks":85,"open_issues":118,"watchers":107,"default_branch":"dev"}},"base":{"label":"Wikia:dev","ref":"dev","sha":"a367e16ba1894d15d1b6d27ab45bc2aa1f9821d3","user":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"repo":{"id":5532313,"name":"app","full_name":"Wikia/app","owner":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Wikia/app","description":"Wikia Application Code","fork":false,"url":"https://api.github.com/repos/Wikia/app","forks_url":"https://api.github.com/repos/Wikia/app/forks","keys_url":"https://api.github.com/repos/Wikia/app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Wikia/app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Wikia/app/teams","hooks_url":"https://api.github.com/repos/Wikia/app/hooks","issue_events_url":"https://api.github.com/repos/Wikia/app/issues/events{/number}","events_url":"https://api.github.com/repos/Wikia/app/events","assignees_url":"https://api.github.com/repos/Wikia/app/assignees{/user}","branches_url":"https://api.github.com/repos/Wikia/app/branches{/branch}","tags_url":"https://api.github.com/repos/Wikia/app/tags","blobs_url":"https://api.github.com/repos/Wikia/app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Wikia/app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Wikia/app/git/refs{/sha}","trees_url":"https://api.github.com/repos/Wikia/app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Wikia/app/statuses/{sha}","languages_url":"https://api.github.com/repos/Wikia/app/languages","stargazers_url":"https://api.github.com/repos/Wikia/app/stargazers","contributors_url":"https://api.github.com/repos/Wikia/app/contributors","subscribers_url":"https://api.github.com/repos/Wikia/app/subscribers","subscription_url":"https://api.github.com/repos/Wikia/app/subscription","commits_url":"https://api.github.com/repos/Wikia/app/commits{/sha}","git_commits_url":"https://api.github.com/repos/Wikia/app/git/commits{/sha}","comments_url":"https://api.github.com/repos/Wikia/app/comments{/number}","issue_comment_url":"https://api.github.com/repos/Wikia/app/issues/comments{/number}","contents_url":"https://api.github.com/repos/Wikia/app/contents/{+path}","compare_url":"https://api.github.com/repos/Wikia/app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Wikia/app/merges","archive_url":"https://api.github.com/repos/Wikia/app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Wikia/app/downloads","issues_url":"https://api.github.com/repos/Wikia/app/issues{/number}","pulls_url":"https://api.github.com/repos/Wikia/app/pulls{/number}","milestones_url":"https://api.github.com/repos/Wikia/app/milestones{/number}","notifications_url":"https://api.github.com/repos/Wikia/app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Wikia/app/labels{/name}","releases_url":"https://api.github.com/repos/Wikia/app/releases{/id}","deployments_url":"https://api.github.com/repos/Wikia/app/deployments","created_at":"2012-08-23T20:55:58Z","updated_at":"2016-12-03T22:51:32Z","pushed_at":"2016-12-06T10:06:26Z","git_url":"git://github.com/Wikia/app.git","ssh_url":"git@github.com:Wikia/app.git","clone_url":"https://github.com/Wikia/app.git","svn_url":"https://github.com/Wikia/app","homepage":"http://dev.wikia.com","size":1494598,"stargazers_count":107,"watchers_count":107,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":85,"mirror_url":null,"open_issues_count":118,"forks":85,"open_issues":118,"watchers":107,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/Wikia/app/pulls/12086"},"html":{"href":"https://github.com/Wikia/app/pull/12086"},"issue":{"href":"https://api.github.com/repos/Wikia/app/issues/12086"},"comments":{"href":"https://api.github.com/repos/Wikia/app/issues/12086/comments"},"review_comments":{"href":"https://api.github.com/repos/Wikia/app/pulls/12086/comments"},"review_comment":{"href":"https://api.github.com/repos/Wikia/app/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Wikia/app/pulls/12086/commits"},"statuses":{"href":"https://api.github.com/repos/Wikia/app/statuses/5df4f70caee7a6d19de47609357605d3f73e6521"}}}}
{"actor":{"display_login":"WikiaTech"}}