{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/28957076","id":28957076,"diff_hunk":"@@ -147,7 +187,61 @@ public void doXContent(XContentBuilder builder, Params params) throws IOExceptio\n     }\n \n     @Override\n+    public Query toQuery(QueryParseContext parseContext) throws QueryParsingException, IOException {\n+        Query query = null;\n+        Preconditions.checkNotNull(this.fieldName, \"Fieldname of a TermQuery cannot be null.\");\n+        Preconditions.checkNotNull(this.value, \"Value of a TermQuery cannot be null.\");","path":"src/main/java/org/elasticsearch/index/query/TermQueryBuilder.java","position":116,"original_position":116,"commit_id":"8f4218e7dfb87bb974dc06ede647b0408915a049","original_commit_id":"8f4218e7dfb87bb974dc06ede647b0408915a049","user":{"login":"cbuescher","id":10398885,"avatar_url":"https://avatars.githubusercontent.com/u/10398885?v=3","gravatar_id":"","url":"https://api.github.com/users/cbuescher","html_url":"https://github.com/cbuescher","followers_url":"https://api.github.com/users/cbuescher/followers","following_url":"https://api.github.com/users/cbuescher/following{/other_user}","gists_url":"https://api.github.com/users/cbuescher/gists{/gist_id}","starred_url":"https://api.github.com/users/cbuescher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbuescher/subscriptions","organizations_url":"https://api.github.com/users/cbuescher/orgs","repos_url":"https://api.github.com/users/cbuescher/repos","events_url":"https://api.github.com/users/cbuescher/events{/privacy}","received_events_url":"https://api.github.com/users/cbuescher/received_events","type":"User","site_admin":false},"body":"I added a validation method for TermQueryBuilder and reused that in the parser. Only downside of this is where previously we had a QueryParseException we now have a ElasticsearchNullPointerException, or we need to try/catch and rethrow which IMHO defeats the purpose. Have a look and let me know what you think.","created_at":"2015-04-23T12:22:51Z","updated_at":"2015-04-23T12:22:51Z","html_url":"https://github.com/elastic/elasticsearch/pull/10669#discussion_r28957076","pull_request_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/10669","_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/28957076"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/10669#discussion_r28957076"},"pull_request":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/10669"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/10669","id":33643663,"html_url":"https://github.com/elastic/elasticsearch/pull/10669","diff_url":"https://github.com/elastic/elasticsearch/pull/10669.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/10669.patch","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/10669","number":10669,"state":"open","locked":false,"title":"Query refactoring: TermQueryBuilder refactoring and test","user":{"login":"cbuescher","id":10398885,"avatar_url":"https://avatars.githubusercontent.com/u/10398885?v=3","gravatar_id":"","url":"https://api.github.com/users/cbuescher","html_url":"https://github.com/cbuescher","followers_url":"https://api.github.com/users/cbuescher/followers","following_url":"https://api.github.com/users/cbuescher/following{/other_user}","gists_url":"https://api.github.com/users/cbuescher/gists{/gist_id}","starred_url":"https://api.github.com/users/cbuescher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbuescher/subscriptions","organizations_url":"https://api.github.com/users/cbuescher/orgs","repos_url":"https://api.github.com/users/cbuescher/repos","events_url":"https://api.github.com/users/cbuescher/events{/privacy}","received_events_url":"https://api.github.com/users/cbuescher/received_events","type":"User","site_admin":false},"body":"Split the parse(QueryParseContext ctx) method into a parsing and a query building part, adding Streamable for serialization and hashCode(), equals() for better testing.\r\nAdd basic unit test for Builder and Parser.\r\n\r\nPR goes agains query-refacoring feature branch.\r\n","created_at":"2015-04-20T08:17:25Z","updated_at":"2015-04-23T12:22:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b56ef483d6bab9bffc1723231e545f128632bf51","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/10669/commits","review_comments_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/10669/comments","review_comment_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/10669/comments","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/8f4218e7dfb87bb974dc06ede647b0408915a049","head":{"label":"cbuescher:feature/query-refactoring-termquery","ref":"feature/query-refactoring-termquery","sha":"8f4218e7dfb87bb974dc06ede647b0408915a049","user":{"login":"cbuescher","id":10398885,"avatar_url":"https://avatars.githubusercontent.com/u/10398885?v=3","gravatar_id":"","url":"https://api.github.com/users/cbuescher","html_url":"https://github.com/cbuescher","followers_url":"https://api.github.com/users/cbuescher/followers","following_url":"https://api.github.com/users/cbuescher/following{/other_user}","gists_url":"https://api.github.com/users/cbuescher/gists{/gist_id}","starred_url":"https://api.github.com/users/cbuescher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbuescher/subscriptions","organizations_url":"https://api.github.com/users/cbuescher/orgs","repos_url":"https://api.github.com/users/cbuescher/repos","events_url":"https://api.github.com/users/cbuescher/events{/privacy}","received_events_url":"https://api.github.com/users/cbuescher/received_events","type":"User","site_admin":false},"repo":{"id":28811483,"name":"elasticsearch","full_name":"cbuescher/elasticsearch","owner":{"login":"cbuescher","id":10398885,"avatar_url":"https://avatars.githubusercontent.com/u/10398885?v=3","gravatar_id":"","url":"https://api.github.com/users/cbuescher","html_url":"https://github.com/cbuescher","followers_url":"https://api.github.com/users/cbuescher/followers","following_url":"https://api.github.com/users/cbuescher/following{/other_user}","gists_url":"https://api.github.com/users/cbuescher/gists{/gist_id}","starred_url":"https://api.github.com/users/cbuescher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbuescher/subscriptions","organizations_url":"https://api.github.com/users/cbuescher/orgs","repos_url":"https://api.github.com/users/cbuescher/repos","events_url":"https://api.github.com/users/cbuescher/events{/privacy}","received_events_url":"https://api.github.com/users/cbuescher/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cbuescher/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":true,"url":"https://api.github.com/repos/cbuescher/elasticsearch","forks_url":"https://api.github.com/repos/cbuescher/elasticsearch/forks","keys_url":"https://api.github.com/repos/cbuescher/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cbuescher/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cbuescher/elasticsearch/teams","hooks_url":"https://api.github.com/repos/cbuescher/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/cbuescher/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/cbuescher/elasticsearch/events","assignees_url":"https://api.github.com/repos/cbuescher/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/cbuescher/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/cbuescher/elasticsearch/tags","blobs_url":"https://api.github.com/repos/cbuescher/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cbuescher/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cbuescher/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/cbuescher/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cbuescher/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/cbuescher/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/cbuescher/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/cbuescher/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/cbuescher/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/cbuescher/elasticsearch/subscription","commits_url":"https://api.github.com/repos/cbuescher/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/cbuescher/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/cbuescher/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/cbuescher/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/cbuescher/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/cbuescher/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cbuescher/elasticsearch/merges","archive_url":"https://api.github.com/repos/cbuescher/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cbuescher/elasticsearch/downloads","issues_url":"https://api.github.com/repos/cbuescher/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/cbuescher/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/cbuescher/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/cbuescher/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cbuescher/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/cbuescher/elasticsearch/releases{/id}","created_at":"2015-01-05T12:21:34Z","updated_at":"2015-01-19T11:05:49Z","pushed_at":"2015-04-22T16:31:29Z","git_url":"git://github.com/cbuescher/elasticsearch.git","ssh_url":"git@github.com:cbuescher/elasticsearch.git","clone_url":"https://github.com/cbuescher/elasticsearch.git","svn_url":"https://github.com/cbuescher/elasticsearch","homepage":"http://elasticsearch.org","size":115509,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"elastic:feature/query-refactoring","ref":"feature/query-refactoring","sha":"eea7ee5d25e0fceb5eb61686a79cdf5f3ce18898","user":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":507775,"name":"elasticsearch","full_name":"elastic/elasticsearch","owner":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":false,"url":"https://api.github.com/repos/elastic/elasticsearch","forks_url":"https://api.github.com/repos/elastic/elasticsearch/forks","keys_url":"https://api.github.com/repos/elastic/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/elasticsearch/teams","hooks_url":"https://api.github.com/repos/elastic/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/elasticsearch/events","assignees_url":"https://api.github.com/repos/elastic/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/elasticsearch/tags","blobs_url":"https://api.github.com/repos/elastic/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/elastic/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/elastic/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/elastic/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/elastic/elasticsearch/subscription","commits_url":"https://api.github.com/repos/elastic/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/elasticsearch/merges","archive_url":"https://api.github.com/repos/elastic/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/elasticsearch/downloads","issues_url":"https://api.github.com/repos/elastic/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/elastic/elasticsearch/releases{/id}","created_at":"2010-02-08T13:20:56Z","updated_at":"2015-04-23T12:05:17Z","pushed_at":"2015-04-23T12:13:17Z","git_url":"git://github.com/elastic/elasticsearch.git","ssh_url":"git@github.com:elastic/elasticsearch.git","clone_url":"https://github.com/elastic/elasticsearch.git","svn_url":"https://github.com/elastic/elasticsearch","homepage":"http://elasticsearch.org","size":337173,"stargazers_count":10911,"watchers_count":10911,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3426,"mirror_url":null,"open_issues_count":1116,"forks":3426,"open_issues":1116,"watchers":10911,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/10669"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/10669"},"issue":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/10669"},"comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/10669/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/10669/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/10669/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/elasticsearch/statuses/8f4218e7dfb87bb974dc06ede647b0408915a049"}}}}