{"action":"created","comment":{"url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/pulls/comments/124987496","pull_request_review_id":46474376,"id":124987496,"diff_hunk":"@@ -0,0 +1,143 @@\n+/*\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ *\n+ */\n+\n+package com.o19s.es.explore;\n+\n+import org.apache.lucene.search.Query;\n+import org.elasticsearch.common.ParseField;\n+import org.elasticsearch.common.ParsingException;\n+import org.elasticsearch.common.io.stream.NamedWriteable;\n+import org.elasticsearch.common.io.stream.StreamInput;\n+import org.elasticsearch.common.io.stream.StreamOutput;\n+import org.elasticsearch.common.xcontent.ObjectParser;\n+import org.elasticsearch.common.xcontent.XContentBuilder;\n+import org.elasticsearch.common.xcontent.XContentParser;\n+import org.elasticsearch.index.query.AbstractQueryBuilder;\n+import org.elasticsearch.index.query.QueryBuilder;\n+import org.elasticsearch.index.query.QueryParseContext;\n+import org.elasticsearch.index.query.QueryShardContext;\n+\n+import java.io.IOException;\n+import java.util.Objects;\n+import java.util.Optional;\n+\n+public class ExplorerQueryBuilder extends AbstractQueryBuilder<ExplorerQueryBuilder> implements NamedWriteable{\n+    public static final String NAME = \"match_explorer\";\n+\n+    private static final ParseField QUERY_NAME = new ParseField(\"query\");\n+    private static final ParseField TYPE_NAME = new ParseField(\"type\");\n+\n+    private QueryBuilder query;\n+    private String type;\n+\n+    private static final ObjectParser<ExplorerQueryBuilder, QueryParseContext> PARSER;\n+\n+    static {\n+        PARSER = new ObjectParser<>(NAME, ExplorerQueryBuilder::new);\n+        PARSER.declareObject(\n+                ExplorerQueryBuilder::query,\n+                (parser, context) -> context.parseInnerQueryBuilder().get(),\n+                QUERY_NAME\n+        );\n+        PARSER.declareString(ExplorerQueryBuilder::statsType, TYPE_NAME);\n+        declareStandardFields(PARSER);\n+    }\n+\n+\n+    public ExplorerQueryBuilder() {\n+    }\n+\n+    public ExplorerQueryBuilder(StreamInput in) throws IOException {\n+        super(in);\n+        query = in.readNamedWriteable(QueryBuilder.class);\n+        type = in.readString();\n+    }\n+\n+    @Override\n+    protected void doWriteTo(StreamOutput out) throws IOException {\n+        out.writeNamedWriteable(query);\n+        out.writeString(type);\n+    }\n+\n+    @Override\n+    protected void doXContent(XContentBuilder builder, Params params) throws IOException {\n+        builder.startObject(NAME);\n+","path":"src/main/java/com/o19s/es/explore/ExplorerQueryBuilder.java","position":77,"original_position":77,"commit_id":"c1f8f1022fda0a939b992896dd6719d5a0a157cc","original_commit_id":"c1f8f1022fda0a939b992896dd6719d5a0a157cc","user":{"login":"nomoa","id":5939211,"avatar_url":"https://avatars2.githubusercontent.com/u/5939211?v=3","gravatar_id":"","url":"https://api.github.com/users/nomoa","html_url":"https://github.com/nomoa","followers_url":"https://api.github.com/users/nomoa/followers","following_url":"https://api.github.com/users/nomoa/following{/other_user}","gists_url":"https://api.github.com/users/nomoa/gists{/gist_id}","starred_url":"https://api.github.com/users/nomoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nomoa/subscriptions","organizations_url":"https://api.github.com/users/nomoa/orgs","repos_url":"https://api.github.com/users/nomoa/repos","events_url":"https://api.github.com/users/nomoa/events{/privacy}","received_events_url":"https://api.github.com/users/nomoa/received_events","type":"User","site_admin":false},"body":"nitpick: the code would look better without the empty lines","created_at":"2017-06-30T08:22:43Z","updated_at":"2017-06-30T08:57:03Z","html_url":"https://github.com/o19s/elasticsearch-learning-to-rank/pull/50#discussion_r124987496","pull_request_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/pulls/50","_links":{"self":{"href":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/pulls/comments/124987496"},"html":{"href":"https://github.com/o19s/elasticsearch-learning-to-rank/pull/50#discussion_r124987496"},"pull_request":{"href":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/pulls/50"}}},"pull_request":{"url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/pulls/50","id":126575312,"html_url":"https://github.com/o19s/elasticsearch-learning-to-rank/pull/50","diff_url":"https://github.com/o19s/elasticsearch-learning-to-rank/pull/50.diff","patch_url":"https://github.com/o19s/elasticsearch-learning-to-rank/pull/50.patch","issue_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/issues/50","number":50,"state":"open","locked":false,"title":"New stat scoring features","user":{"login":"worleydl","id":615271,"avatar_url":"https://avatars1.githubusercontent.com/u/615271?v=3","gravatar_id":"","url":"https://api.github.com/users/worleydl","html_url":"https://github.com/worleydl","followers_url":"https://api.github.com/users/worleydl/followers","following_url":"https://api.github.com/users/worleydl/following{/other_user}","gists_url":"https://api.github.com/users/worleydl/gists{/gist_id}","starred_url":"https://api.github.com/users/worleydl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/worleydl/subscriptions","organizations_url":"https://api.github.com/users/worleydl/orgs","repos_url":"https://api.github.com/users/worleydl/repos","events_url":"https://api.github.com/users/worleydl/events{/privacy}","received_events_url":"https://api.github.com/users/worleydl/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-06-20T16:23:52Z","updated_at":"2017-06-30T08:57:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7c2e976910ff4ca4f4f309dae6e57db9549ca85d","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/pulls/50/commits","review_comments_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/pulls/50/comments","review_comment_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/pulls/comments{/number}","comments_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/issues/50/comments","statuses_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/statuses/c1f8f1022fda0a939b992896dd6719d5a0a157cc","head":{"label":"worleydl:feature/explorer","ref":"feature/explorer","sha":"c1f8f1022fda0a939b992896dd6719d5a0a157cc","user":{"login":"worleydl","id":615271,"avatar_url":"https://avatars1.githubusercontent.com/u/615271?v=3","gravatar_id":"","url":"https://api.github.com/users/worleydl","html_url":"https://github.com/worleydl","followers_url":"https://api.github.com/users/worleydl/followers","following_url":"https://api.github.com/users/worleydl/following{/other_user}","gists_url":"https://api.github.com/users/worleydl/gists{/gist_id}","starred_url":"https://api.github.com/users/worleydl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/worleydl/subscriptions","organizations_url":"https://api.github.com/users/worleydl/orgs","repos_url":"https://api.github.com/users/worleydl/repos","events_url":"https://api.github.com/users/worleydl/events{/privacy}","received_events_url":"https://api.github.com/users/worleydl/received_events","type":"User","site_admin":false},"repo":{"id":94460291,"name":"elasticsearch-learning-to-rank","full_name":"worleydl/elasticsearch-learning-to-rank","owner":{"login":"worleydl","id":615271,"avatar_url":"https://avatars1.githubusercontent.com/u/615271?v=3","gravatar_id":"","url":"https://api.github.com/users/worleydl","html_url":"https://github.com/worleydl","followers_url":"https://api.github.com/users/worleydl/followers","following_url":"https://api.github.com/users/worleydl/following{/other_user}","gists_url":"https://api.github.com/users/worleydl/gists{/gist_id}","starred_url":"https://api.github.com/users/worleydl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/worleydl/subscriptions","organizations_url":"https://api.github.com/users/worleydl/orgs","repos_url":"https://api.github.com/users/worleydl/repos","events_url":"https://api.github.com/users/worleydl/events{/privacy}","received_events_url":"https://api.github.com/users/worleydl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/worleydl/elasticsearch-learning-to-rank","description":"Plugin to integrate Learning to Rank (aka machine learning for better relevance) with Elasticsearch","fork":true,"url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank","forks_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/forks","keys_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/keys{/key_id}","collaborators_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/teams","hooks_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/hooks","issue_events_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/issues/events{/number}","events_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/events","assignees_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/assignees{/user}","branches_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/branches{/branch}","tags_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/tags","blobs_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/git/refs{/sha}","trees_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/git/trees{/sha}","statuses_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/statuses/{sha}","languages_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/languages","stargazers_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/stargazers","contributors_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/contributors","subscribers_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/subscribers","subscription_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/subscription","commits_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/commits{/sha}","git_commits_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/git/commits{/sha}","comments_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/comments{/number}","issue_comment_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/issues/comments{/number}","contents_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/contents/{+path}","compare_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/compare/{base}...{head}","merges_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/merges","archive_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/downloads","issues_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/issues{/number}","pulls_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/pulls{/number}","milestones_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/milestones{/number}","notifications_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/labels{/name}","releases_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/releases{/id}","deployments_url":"https://api.github.com/repos/worleydl/elasticsearch-learning-to-rank/deployments","created_at":"2017-06-15T16:52:31Z","updated_at":"2017-06-15T16:52:32Z","pushed_at":"2017-06-29T18:00:31Z","git_url":"git://github.com/worleydl/elasticsearch-learning-to-rank.git","ssh_url":"git@github.com:worleydl/elasticsearch-learning-to-rank.git","clone_url":"https://github.com/worleydl/elasticsearch-learning-to-rank.git","svn_url":"https://github.com/worleydl/elasticsearch-learning-to-rank","homepage":"http://opensourceconnections.com/blog/2017/02/14/elasticsearch-learning-to-rank/","size":509,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"o19s:1_0","ref":"1_0","sha":"bdcff41464ff8f934ca79cc293c57184197c586c","user":{"login":"o19s","id":339001,"avatar_url":"https://avatars1.githubusercontent.com/u/339001?v=3","gravatar_id":"","url":"https://api.github.com/users/o19s","html_url":"https://github.com/o19s","followers_url":"https://api.github.com/users/o19s/followers","following_url":"https://api.github.com/users/o19s/following{/other_user}","gists_url":"https://api.github.com/users/o19s/gists{/gist_id}","starred_url":"https://api.github.com/users/o19s/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/o19s/subscriptions","organizations_url":"https://api.github.com/users/o19s/orgs","repos_url":"https://api.github.com/users/o19s/repos","events_url":"https://api.github.com/users/o19s/events{/privacy}","received_events_url":"https://api.github.com/users/o19s/received_events","type":"Organization","site_admin":false},"repo":{"id":77308564,"name":"elasticsearch-learning-to-rank","full_name":"o19s/elasticsearch-learning-to-rank","owner":{"login":"o19s","id":339001,"avatar_url":"https://avatars1.githubusercontent.com/u/339001?v=3","gravatar_id":"","url":"https://api.github.com/users/o19s","html_url":"https://github.com/o19s","followers_url":"https://api.github.com/users/o19s/followers","following_url":"https://api.github.com/users/o19s/following{/other_user}","gists_url":"https://api.github.com/users/o19s/gists{/gist_id}","starred_url":"https://api.github.com/users/o19s/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/o19s/subscriptions","organizations_url":"https://api.github.com/users/o19s/orgs","repos_url":"https://api.github.com/users/o19s/repos","events_url":"https://api.github.com/users/o19s/events{/privacy}","received_events_url":"https://api.github.com/users/o19s/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/o19s/elasticsearch-learning-to-rank","description":"Plugin to integrate Learning to Rank (aka machine learning for better relevance) with Elasticsearch","fork":false,"url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank","forks_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/forks","keys_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/keys{/key_id}","collaborators_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/teams","hooks_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/hooks","issue_events_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/issues/events{/number}","events_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/events","assignees_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/assignees{/user}","branches_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/branches{/branch}","tags_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/tags","blobs_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/git/refs{/sha}","trees_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/git/trees{/sha}","statuses_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/statuses/{sha}","languages_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/languages","stargazers_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/stargazers","contributors_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/contributors","subscribers_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/subscribers","subscription_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/subscription","commits_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/commits{/sha}","git_commits_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/git/commits{/sha}","comments_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/comments{/number}","issue_comment_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/issues/comments{/number}","contents_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/contents/{+path}","compare_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/compare/{base}...{head}","merges_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/merges","archive_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/downloads","issues_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/issues{/number}","pulls_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/pulls{/number}","milestones_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/milestones{/number}","notifications_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/labels{/name}","releases_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/releases{/id}","deployments_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/deployments","created_at":"2016-12-25T03:19:01Z","updated_at":"2017-06-29T08:15:21Z","pushed_at":"2017-06-29T18:00:33Z","git_url":"git://github.com/o19s/elasticsearch-learning-to-rank.git","ssh_url":"git@github.com:o19s/elasticsearch-learning-to-rank.git","clone_url":"https://github.com/o19s/elasticsearch-learning-to-rank.git","svn_url":"https://github.com/o19s/elasticsearch-learning-to-rank","homepage":"http://opensourceconnections.com/blog/2017/02/14/elasticsearch-learning-to-rank/","size":525,"stargazers_count":231,"watchers_count":231,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":54,"mirror_url":null,"open_issues_count":22,"forks":54,"open_issues":22,"watchers":231,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/pulls/50"},"html":{"href":"https://github.com/o19s/elasticsearch-learning-to-rank/pull/50"},"issue":{"href":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/issues/50"},"comments":{"href":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/issues/50/comments"},"review_comments":{"href":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/pulls/50/comments"},"review_comment":{"href":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/pulls/50/commits"},"statuses":{"href":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/statuses/c1f8f1022fda0a939b992896dd6719d5a0a157cc"}}}}
{"actor":{"display_login":"nomoa"}}