{"action":"created","comment":{"url":"https://api.github.com/repos/Metatavu/kunta-api-server/pulls/comments/206786298","pull_request_review_id":142264117,"id":206786298,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNjc4NjI5OA==","diff_hunk":"@@ -0,0 +1,85 @@\n+package fi.metatavu.kuntaapi.server.index;\n+\n+import static org.elasticsearch.index.query.QueryBuilders.boolQuery;\n+import static org.elasticsearch.index.query.QueryBuilders.matchQuery;\n+import static org.elasticsearch.index.query.QueryBuilders.queryStringQuery;\n+\n+import java.util.logging.Logger;\n+\n+import javax.enterprise.context.ApplicationScoped;\n+import javax.inject.Inject;\n+\n+import org.elasticsearch.action.search.SearchRequestBuilder;\n+import org.elasticsearch.index.query.BoolQueryBuilder;\n+import org.elasticsearch.index.query.QueryBuilder;\n+import org.elasticsearch.search.sort.SortOrder;\n+\n+import fi.metatavu.kuntaapi.server.id.FileId;\n+import fi.metatavu.kuntaapi.server.id.IdController;\n+import fi.metatavu.kuntaapi.server.id.OrganizationId;\n+import fi.metatavu.kuntaapi.server.id.PageId;\n+import fi.metatavu.kuntaapi.server.integrations.KuntaApiConsts;\n+\n+@ApplicationScoped\n+public class FileSearcher {\n+  \n+  private static final String TYPE = \"file\";\n+  private static final String FILE_ID_FIELD = \"fileId\";\n+  private static final String PAGE_ID_FIELD = \"pageId\";\n+  private static final String ORGANIZATION_ID_FIELD = \"organizationId\";\n+  \n+  @Inject\n+  private Logger logger;\n+  \n+  @Inject\n+  private IdController idController;\n+  \n+  @Inject\n+  private IndexReader indexReader;\n+\n+  public SearchResult<FileId> searchFiles(OrganizationId organizationId, PageId pageId, String queryString, Long firstResult, Long maxResults) {\n+    OrganizationId kuntaApiOrganizationId = idController.translateOrganizationId(organizationId, KuntaApiConsts.IDENTIFIER_NAME);\n+    if (kuntaApiOrganizationId == null) {\n+      logger.severe(String.format(\"Failed to translate organization %s into Kunta API id\", organizationId.toString()));","path":"src/main/java/fi/metatavu/kuntaapi/server/index/FileSearcher.java","position":43,"original_position":43,"commit_id":"0d5f762c05dc0890a94a64521677516f3fe2b897","original_commit_id":"0d5f762c05dc0890a94a64521677516f3fe2b897","user":{"login":"sonarq","id":21039853,"node_id":"MDQ6VXNlcjIxMDM5ODUz","avatar_url":"https://avatars1.githubusercontent.com/u/21039853?v=4","gravatar_id":"","url":"https://api.github.com/users/sonarq","html_url":"https://github.com/sonarq","followers_url":"https://api.github.com/users/sonarq/followers","following_url":"https://api.github.com/users/sonarq/following{/other_user}","gists_url":"https://api.github.com/users/sonarq/gists{/gist_id}","starred_url":"https://api.github.com/users/sonarq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sonarq/subscriptions","organizations_url":"https://api.github.com/users/sonarq/orgs","repos_url":"https://api.github.com/users/sonarq/repos","events_url":"https://api.github.com/users/sonarq/events{/privacy}","received_events_url":"https://api.github.com/users/sonarq/received_events","type":"User","site_admin":false},"body":"![MAJOR](https://sonarsource.github.io/sonar-github/severity-major.png 'Severity: MAJOR') Invoke method(s) only conditionally. [![rule](https://sonarsource.github.io/sonar-github/rule.png)](https://sonarcloud.io/coding_rules#rule_key=squid%3AS2629)\n","created_at":"2018-08-01T07:58:14Z","updated_at":"2018-08-01T07:58:14Z","html_url":"https://github.com/Metatavu/kunta-api-server/pull/507#discussion_r206786298","pull_request_url":"https://api.github.com/repos/Metatavu/kunta-api-server/pulls/507","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Metatavu/kunta-api-server/pulls/comments/206786298"},"html":{"href":"https://github.com/Metatavu/kunta-api-server/pull/507#discussion_r206786298"},"pull_request":{"href":"https://api.github.com/repos/Metatavu/kunta-api-server/pulls/507"}}},"pull_request":{"url":"https://api.github.com/repos/Metatavu/kunta-api-server/pulls/507","id":205309213,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1MzA5MjEz","html_url":"https://github.com/Metatavu/kunta-api-server/pull/507","diff_url":"https://github.com/Metatavu/kunta-api-server/pull/507.diff","patch_url":"https://github.com/Metatavu/kunta-api-server/pull/507.patch","issue_url":"https://api.github.com/repos/Metatavu/kunta-api-server/issues/507","number":507,"state":"open","locked":false,"title":"Feature #506 fix package name","user":{"login":"anttileppa","id":1730736,"node_id":"MDQ6VXNlcjE3MzA3MzY=","avatar_url":"https://avatars3.githubusercontent.com/u/1730736?v=4","gravatar_id":"","url":"https://api.github.com/users/anttileppa","html_url":"https://github.com/anttileppa","followers_url":"https://api.github.com/users/anttileppa/followers","following_url":"https://api.github.com/users/anttileppa/following{/other_user}","gists_url":"https://api.github.com/users/anttileppa/gists{/gist_id}","starred_url":"https://api.github.com/users/anttileppa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anttileppa/subscriptions","organizations_url":"https://api.github.com/users/anttileppa/orgs","repos_url":"https://api.github.com/users/anttileppa/repos","events_url":"https://api.github.com/users/anttileppa/events{/privacy}","received_events_url":"https://api.github.com/users/anttileppa/received_events","type":"User","site_admin":false},"body":"Resolves #506","created_at":"2018-08-01T04:59:25Z","updated_at":"2018-08-01T07:58:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4845c5405892b71d88b6f3cd7dcafc13bea306e4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Metatavu/kunta-api-server/pulls/507/commits","review_comments_url":"https://api.github.com/repos/Metatavu/kunta-api-server/pulls/507/comments","review_comment_url":"https://api.github.com/repos/Metatavu/kunta-api-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Metatavu/kunta-api-server/issues/507/comments","statuses_url":"https://api.github.com/repos/Metatavu/kunta-api-server/statuses/0d5f762c05dc0890a94a64521677516f3fe2b897","head":{"label":"Metatavu:feature-#506-fix-package-name","ref":"feature-#506-fix-package-name","sha":"0d5f762c05dc0890a94a64521677516f3fe2b897","user":{"login":"Metatavu","id":20443466,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNDQzNDY2","avatar_url":"https://avatars0.githubusercontent.com/u/20443466?v=4","gravatar_id":"","url":"https://api.github.com/users/Metatavu","html_url":"https://github.com/Metatavu","followers_url":"https://api.github.com/users/Metatavu/followers","following_url":"https://api.github.com/users/Metatavu/following{/other_user}","gists_url":"https://api.github.com/users/Metatavu/gists{/gist_id}","starred_url":"https://api.github.com/users/Metatavu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metatavu/subscriptions","organizations_url":"https://api.github.com/users/Metatavu/orgs","repos_url":"https://api.github.com/users/Metatavu/repos","events_url":"https://api.github.com/users/Metatavu/events{/privacy}","received_events_url":"https://api.github.com/users/Metatavu/received_events","type":"Organization","site_admin":false},"repo":{"id":75393004,"node_id":"MDEwOlJlcG9zaXRvcnk3NTM5MzAwNA==","name":"kunta-api-server","full_name":"Metatavu/kunta-api-server","owner":{"login":"Metatavu","id":20443466,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNDQzNDY2","avatar_url":"https://avatars0.githubusercontent.com/u/20443466?v=4","gravatar_id":"","url":"https://api.github.com/users/Metatavu","html_url":"https://github.com/Metatavu","followers_url":"https://api.github.com/users/Metatavu/followers","following_url":"https://api.github.com/users/Metatavu/following{/other_user}","gists_url":"https://api.github.com/users/Metatavu/gists{/gist_id}","starred_url":"https://api.github.com/users/Metatavu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metatavu/subscriptions","organizations_url":"https://api.github.com/users/Metatavu/orgs","repos_url":"https://api.github.com/users/Metatavu/repos","events_url":"https://api.github.com/users/Metatavu/events{/privacy}","received_events_url":"https://api.github.com/users/Metatavu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Metatavu/kunta-api-server","description":null,"fork":false,"url":"https://api.github.com/repos/Metatavu/kunta-api-server","forks_url":"https://api.github.com/repos/Metatavu/kunta-api-server/forks","keys_url":"https://api.github.com/repos/Metatavu/kunta-api-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Metatavu/kunta-api-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Metatavu/kunta-api-server/teams","hooks_url":"https://api.github.com/repos/Metatavu/kunta-api-server/hooks","issue_events_url":"https://api.github.com/repos/Metatavu/kunta-api-server/issues/events{/number}","events_url":"https://api.github.com/repos/Metatavu/kunta-api-server/events","assignees_url":"https://api.github.com/repos/Metatavu/kunta-api-server/assignees{/user}","branches_url":"https://api.github.com/repos/Metatavu/kunta-api-server/branches{/branch}","tags_url":"https://api.github.com/repos/Metatavu/kunta-api-server/tags","blobs_url":"https://api.github.com/repos/Metatavu/kunta-api-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Metatavu/kunta-api-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Metatavu/kunta-api-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/Metatavu/kunta-api-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Metatavu/kunta-api-server/statuses/{sha}","languages_url":"https://api.github.com/repos/Metatavu/kunta-api-server/languages","stargazers_url":"https://api.github.com/repos/Metatavu/kunta-api-server/stargazers","contributors_url":"https://api.github.com/repos/Metatavu/kunta-api-server/contributors","subscribers_url":"https://api.github.com/repos/Metatavu/kunta-api-server/subscribers","subscription_url":"https://api.github.com/repos/Metatavu/kunta-api-server/subscription","commits_url":"https://api.github.com/repos/Metatavu/kunta-api-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/Metatavu/kunta-api-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/Metatavu/kunta-api-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/Metatavu/kunta-api-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/Metatavu/kunta-api-server/contents/{+path}","compare_url":"https://api.github.com/repos/Metatavu/kunta-api-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Metatavu/kunta-api-server/merges","archive_url":"https://api.github.com/repos/Metatavu/kunta-api-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Metatavu/kunta-api-server/downloads","issues_url":"https://api.github.com/repos/Metatavu/kunta-api-server/issues{/number}","pulls_url":"https://api.github.com/repos/Metatavu/kunta-api-server/pulls{/number}","milestones_url":"https://api.github.com/repos/Metatavu/kunta-api-server/milestones{/number}","notifications_url":"https://api.github.com/repos/Metatavu/kunta-api-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Metatavu/kunta-api-server/labels{/name}","releases_url":"https://api.github.com/repos/Metatavu/kunta-api-server/releases{/id}","deployments_url":"https://api.github.com/repos/Metatavu/kunta-api-server/deployments","created_at":"2016-12-02T12:16:29Z","updated_at":"2018-08-01T06:19:02Z","pushed_at":"2018-08-01T07:17:31Z","git_url":"git://github.com/Metatavu/kunta-api-server.git","ssh_url":"git@github.com:Metatavu/kunta-api-server.git","clone_url":"https://github.com/Metatavu/kunta-api-server.git","svn_url":"https://github.com/Metatavu/kunta-api-server","homepage":null,"size":4704,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":10,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":0,"open_issues":10,"watchers":1,"default_branch":"develop"}},"base":{"label":"Metatavu:develop","ref":"develop","sha":"1ae8cc4b9b8f4eaceef446deeb39d037ee96065c","user":{"login":"Metatavu","id":20443466,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNDQzNDY2","avatar_url":"https://avatars0.githubusercontent.com/u/20443466?v=4","gravatar_id":"","url":"https://api.github.com/users/Metatavu","html_url":"https://github.com/Metatavu","followers_url":"https://api.github.com/users/Metatavu/followers","following_url":"https://api.github.com/users/Metatavu/following{/other_user}","gists_url":"https://api.github.com/users/Metatavu/gists{/gist_id}","starred_url":"https://api.github.com/users/Metatavu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metatavu/subscriptions","organizations_url":"https://api.github.com/users/Metatavu/orgs","repos_url":"https://api.github.com/users/Metatavu/repos","events_url":"https://api.github.com/users/Metatavu/events{/privacy}","received_events_url":"https://api.github.com/users/Metatavu/received_events","type":"Organization","site_admin":false},"repo":{"id":75393004,"node_id":"MDEwOlJlcG9zaXRvcnk3NTM5MzAwNA==","name":"kunta-api-server","full_name":"Metatavu/kunta-api-server","owner":{"login":"Metatavu","id":20443466,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNDQzNDY2","avatar_url":"https://avatars0.githubusercontent.com/u/20443466?v=4","gravatar_id":"","url":"https://api.github.com/users/Metatavu","html_url":"https://github.com/Metatavu","followers_url":"https://api.github.com/users/Metatavu/followers","following_url":"https://api.github.com/users/Metatavu/following{/other_user}","gists_url":"https://api.github.com/users/Metatavu/gists{/gist_id}","starred_url":"https://api.github.com/users/Metatavu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metatavu/subscriptions","organizations_url":"https://api.github.com/users/Metatavu/orgs","repos_url":"https://api.github.com/users/Metatavu/repos","events_url":"https://api.github.com/users/Metatavu/events{/privacy}","received_events_url":"https://api.github.com/users/Metatavu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Metatavu/kunta-api-server","description":null,"fork":false,"url":"https://api.github.com/repos/Metatavu/kunta-api-server","forks_url":"https://api.github.com/repos/Metatavu/kunta-api-server/forks","keys_url":"https://api.github.com/repos/Metatavu/kunta-api-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Metatavu/kunta-api-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Metatavu/kunta-api-server/teams","hooks_url":"https://api.github.com/repos/Metatavu/kunta-api-server/hooks","issue_events_url":"https://api.github.com/repos/Metatavu/kunta-api-server/issues/events{/number}","events_url":"https://api.github.com/repos/Metatavu/kunta-api-server/events","assignees_url":"https://api.github.com/repos/Metatavu/kunta-api-server/assignees{/user}","branches_url":"https://api.github.com/repos/Metatavu/kunta-api-server/branches{/branch}","tags_url":"https://api.github.com/repos/Metatavu/kunta-api-server/tags","blobs_url":"https://api.github.com/repos/Metatavu/kunta-api-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Metatavu/kunta-api-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Metatavu/kunta-api-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/Metatavu/kunta-api-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Metatavu/kunta-api-server/statuses/{sha}","languages_url":"https://api.github.com/repos/Metatavu/kunta-api-server/languages","stargazers_url":"https://api.github.com/repos/Metatavu/kunta-api-server/stargazers","contributors_url":"https://api.github.com/repos/Metatavu/kunta-api-server/contributors","subscribers_url":"https://api.github.com/repos/Metatavu/kunta-api-server/subscribers","subscription_url":"https://api.github.com/repos/Metatavu/kunta-api-server/subscription","commits_url":"https://api.github.com/repos/Metatavu/kunta-api-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/Metatavu/kunta-api-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/Metatavu/kunta-api-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/Metatavu/kunta-api-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/Metatavu/kunta-api-server/contents/{+path}","compare_url":"https://api.github.com/repos/Metatavu/kunta-api-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Metatavu/kunta-api-server/merges","archive_url":"https://api.github.com/repos/Metatavu/kunta-api-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Metatavu/kunta-api-server/downloads","issues_url":"https://api.github.com/repos/Metatavu/kunta-api-server/issues{/number}","pulls_url":"https://api.github.com/repos/Metatavu/kunta-api-server/pulls{/number}","milestones_url":"https://api.github.com/repos/Metatavu/kunta-api-server/milestones{/number}","notifications_url":"https://api.github.com/repos/Metatavu/kunta-api-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Metatavu/kunta-api-server/labels{/name}","releases_url":"https://api.github.com/repos/Metatavu/kunta-api-server/releases{/id}","deployments_url":"https://api.github.com/repos/Metatavu/kunta-api-server/deployments","created_at":"2016-12-02T12:16:29Z","updated_at":"2018-08-01T06:19:02Z","pushed_at":"2018-08-01T07:17:31Z","git_url":"git://github.com/Metatavu/kunta-api-server.git","ssh_url":"git@github.com:Metatavu/kunta-api-server.git","clone_url":"https://github.com/Metatavu/kunta-api-server.git","svn_url":"https://github.com/Metatavu/kunta-api-server","homepage":null,"size":4704,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":10,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":0,"open_issues":10,"watchers":1,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Metatavu/kunta-api-server/pulls/507"},"html":{"href":"https://github.com/Metatavu/kunta-api-server/pull/507"},"issue":{"href":"https://api.github.com/repos/Metatavu/kunta-api-server/issues/507"},"comments":{"href":"https://api.github.com/repos/Metatavu/kunta-api-server/issues/507/comments"},"review_comments":{"href":"https://api.github.com/repos/Metatavu/kunta-api-server/pulls/507/comments"},"review_comment":{"href":"https://api.github.com/repos/Metatavu/kunta-api-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Metatavu/kunta-api-server/pulls/507/commits"},"statuses":{"href":"https://api.github.com/repos/Metatavu/kunta-api-server/statuses/0d5f762c05dc0890a94a64521677516f3fe2b897"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sonarq"}}