{"action":"created","comment":{"url":"https://api.github.com/repos/cloudant/java-cloudant/pulls/comments/36865396","id":36865396,"diff_hunk":"@@ -107,13 +107,227 @@ public void byStartAndEndKey() {\n         assertThat(foos.size(), is(2));\n     }\n \n+    /**\n+     * Assert that passing a boolean key with value 'false'\n+     * in query and queryView will produce a result list of\n+     * all false docs.\n+     */\n+\n+    @Test\n+    public void byStartAndEndBooleanKey() {\n+        init();\n+\n+        View query = db.view(\"example/boolean\")\n+                .startKey(false)\n+                .endKey(false);\n+\n+        List<Object> result = query.query(Object.class);\n+\n+        assertThat(result.size(), is(3));\n+\n+        Page page = null;\n+        try {\n+            page = query.queryPage(30, null, Object.class);\n+        } catch (Exception e) {\n+            e.printStackTrace();\n+        }\n+\n+        assertThat(page.getResultList().size(), is(3));\n+    }\n+\n+    /**\n+     * Assert that passing a string key with double quotes\n+     * or spaces in query and queryView will produce\n+     * a result list without exception.\n+     */\n+    @Test\n+    public void byStartAndEndStringKey() {\n+        init();\n+\n+        //Query for testing string with spaces\n+        View query = db.view(\"example/spaces_created\")\n+                .startKey(\" spaces \", 1)\n+                .endKey(\" spaces 2\", 2000);\n+\n+        List<Object> result = query.query(Object.class);\n+\n+        assertThat(result.size(), is(3));\n+\n+        Page page = null;\n+        try {\n+            page = query.queryPage(30, null, Object.class);\n+        } catch (Exception e) {\n+            e.printStackTrace();\n+        }\n+\n+        assertThat(page.getResultList().size(), is(3));\n+\n+        //Query for testing string with quotes\n+        query = db.view(\"example/quotes_created\")\n+                .startKey(\"\\\"quotes\\\" \", 1)\n+                .endKey(\"\\\"quotes\\\" 3\", 2000);\n+\n+        result = query.query(Object.class);\n+\n+        assertThat(result.size(), is(3));\n+\n+        page = null;\n+        try {\n+            page = query.queryPage(30, null, Object.class);\n+        } catch (Exception e) {\n+            e.printStackTrace();\n+        }\n+\n+        assertThat(page.getResultList().size(), is(3));\n+    }","path":"src/test/java/com/cloudant/tests/ViewsTest.java","position":null,"original_position":109,"commit_id":"e75a2f17561476a2f7e46ebd4246a53738faa357","original_commit_id":"15663dec12e72528ff636f28491cd385e0a88a79","user":{"login":"emlaver","id":10552966,"avatar_url":"https://avatars.githubusercontent.com/u/10552966?v=3","gravatar_id":"","url":"https://api.github.com/users/emlaver","html_url":"https://github.com/emlaver","followers_url":"https://api.github.com/users/emlaver/followers","following_url":"https://api.github.com/users/emlaver/following{/other_user}","gists_url":"https://api.github.com/users/emlaver/gists{/gist_id}","starred_url":"https://api.github.com/users/emlaver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emlaver/subscriptions","organizations_url":"https://api.github.com/users/emlaver/orgs","repos_url":"https://api.github.com/users/emlaver/repos","events_url":"https://api.github.com/users/emlaver/events{/privacy}","received_events_url":"https://api.github.com/users/emlaver/received_events","type":"User","site_admin":false},"body":"Fixed in e75a2f1","created_at":"2015-08-12T14:25:25Z","updated_at":"2015-08-12T14:25:25Z","html_url":"https://github.com/cloudant/java-cloudant/pull/63#discussion_r36865396","pull_request_url":"https://api.github.com/repos/cloudant/java-cloudant/pulls/63","_links":{"self":{"href":"https://api.github.com/repos/cloudant/java-cloudant/pulls/comments/36865396"},"html":{"href":"https://github.com/cloudant/java-cloudant/pull/63#discussion_r36865396"},"pull_request":{"href":"https://api.github.com/repos/cloudant/java-cloudant/pulls/63"}}},"pull_request":{"url":"https://api.github.com/repos/cloudant/java-cloudant/pulls/63","id":40176284,"html_url":"https://github.com/cloudant/java-cloudant/pull/63","diff_url":"https://github.com/cloudant/java-cloudant/pull/63.diff","patch_url":"https://github.com/cloudant/java-cloudant/pull/63.patch","issue_url":"https://api.github.com/repos/cloudant/java-cloudant/issues/63","number":63,"state":"open","locked":false,"title":"View's queryPage doesn't seem to handle multi-value values","user":{"login":"emlaver","id":10552966,"avatar_url":"https://avatars.githubusercontent.com/u/10552966?v=3","gravatar_id":"","url":"https://api.github.com/users/emlaver","html_url":"https://github.com/emlaver","followers_url":"https://api.github.com/users/emlaver/followers","following_url":"https://api.github.com/users/emlaver/following{/other_user}","gists_url":"https://api.github.com/users/emlaver/gists{/gist_id}","starred_url":"https://api.github.com/users/emlaver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emlaver/subscriptions","organizations_url":"https://api.github.com/users/emlaver/orgs","repos_url":"https://api.github.com/users/emlaver/repos","events_url":"https://api.github.com/users/emlaver/events{/privacy}","received_events_url":"https://api.github.com/users/emlaver/received_events","type":"User","site_admin":false},"body":"*What:*\r\nView’s queryPage doesn’t seem to handle multi-value values (FB 48355)\r\nThe queryPage method doesn’t handle views that emit keys such as [“uuid”, 100].\r\n\r\n#39 DB view key varargs needs parameter typing (FB 48532)\r\nThe key, start key, and end key methods are not able to handle complex keys.  One example is a complex key with multiple integer values i.e. key(2011 10, 15).\r\n\r\n*How:*\r\nThe queryView method in View’s queryPage had a hard cast of String.  This would cause an exception if an integer value existed in a key from the result rows. To fix this:\r\nThe String parameter was changed to Object class to allow for other data types. \r\nIf the key in the result rows is an array of multiple values (i.e. startkey=[“uuid”,100]), the array will be converted into one string and then be added as a property for the page parameters.\r\n\r\nView’s query had a similar problem where multiple number value keys were not property handled when building the URI.  During testing, if a string and integer value existed in a key array, then the URI would be properly created. If the key only contained an array of numbers, then it would throw an exception. \r\nThe fix required a statement in getKeyAsJson to check whether the multi value key array was exactly one value and an instance of the Number class.\r\n\r\n*Testing:*\r\nAn existing test case under ViewsTest (byComplexKey) was modified to use the new multi value change.\r\nNew test cases were added to ViewsTest:\r\nAssert that result list is not empty using multi value keys in both View’s query and queryPage method.\r\nRun tests with multi value key arrays from one to three values\r\n\r\nreviewer @ricellis \r\nreviewer @mikerhodes ","created_at":"2015-07-16T21:09:20Z","updated_at":"2015-08-12T14:25:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"02780a79e4651d7f9d907a753698d2eae6554c40","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cloudant/java-cloudant/pulls/63/commits","review_comments_url":"https://api.github.com/repos/cloudant/java-cloudant/pulls/63/comments","review_comment_url":"https://api.github.com/repos/cloudant/java-cloudant/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cloudant/java-cloudant/issues/63/comments","statuses_url":"https://api.github.com/repos/cloudant/java-cloudant/statuses/e75a2f17561476a2f7e46ebd4246a53738faa357","head":{"label":"cloudant:48355-querypage-multi-value","ref":"48355-querypage-multi-value","sha":"e75a2f17561476a2f7e46ebd4246a53738faa357","user":{"login":"cloudant","id":44642,"avatar_url":"https://avatars.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"repo":{"id":22873328,"name":"java-cloudant","full_name":"cloudant/java-cloudant","owner":{"login":"cloudant","id":44642,"avatar_url":"https://avatars.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudant/java-cloudant","description":"A Java client for Cloudant","fork":false,"url":"https://api.github.com/repos/cloudant/java-cloudant","forks_url":"https://api.github.com/repos/cloudant/java-cloudant/forks","keys_url":"https://api.github.com/repos/cloudant/java-cloudant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudant/java-cloudant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudant/java-cloudant/teams","hooks_url":"https://api.github.com/repos/cloudant/java-cloudant/hooks","issue_events_url":"https://api.github.com/repos/cloudant/java-cloudant/issues/events{/number}","events_url":"https://api.github.com/repos/cloudant/java-cloudant/events","assignees_url":"https://api.github.com/repos/cloudant/java-cloudant/assignees{/user}","branches_url":"https://api.github.com/repos/cloudant/java-cloudant/branches{/branch}","tags_url":"https://api.github.com/repos/cloudant/java-cloudant/tags","blobs_url":"https://api.github.com/repos/cloudant/java-cloudant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudant/java-cloudant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudant/java-cloudant/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudant/java-cloudant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudant/java-cloudant/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudant/java-cloudant/languages","stargazers_url":"https://api.github.com/repos/cloudant/java-cloudant/stargazers","contributors_url":"https://api.github.com/repos/cloudant/java-cloudant/contributors","subscribers_url":"https://api.github.com/repos/cloudant/java-cloudant/subscribers","subscription_url":"https://api.github.com/repos/cloudant/java-cloudant/subscription","commits_url":"https://api.github.com/repos/cloudant/java-cloudant/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudant/java-cloudant/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudant/java-cloudant/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudant/java-cloudant/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudant/java-cloudant/contents/{+path}","compare_url":"https://api.github.com/repos/cloudant/java-cloudant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudant/java-cloudant/merges","archive_url":"https://api.github.com/repos/cloudant/java-cloudant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudant/java-cloudant/downloads","issues_url":"https://api.github.com/repos/cloudant/java-cloudant/issues{/number}","pulls_url":"https://api.github.com/repos/cloudant/java-cloudant/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudant/java-cloudant/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudant/java-cloudant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudant/java-cloudant/labels{/name}","releases_url":"https://api.github.com/repos/cloudant/java-cloudant/releases{/id}","created_at":"2014-08-12T10:19:56Z","updated_at":"2015-08-06T17:49:05Z","pushed_at":"2015-08-12T14:21:58Z","git_url":"git://github.com/cloudant/java-cloudant.git","ssh_url":"git@github.com:cloudant/java-cloudant.git","clone_url":"https://github.com/cloudant/java-cloudant.git","svn_url":"https://github.com/cloudant/java-cloudant","homepage":null,"size":3408,"stargazers_count":12,"watchers_count":12,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":11,"forks":13,"open_issues":11,"watchers":12,"default_branch":"master"}},"base":{"label":"cloudant:master","ref":"master","sha":"85c1a34842c1a4429147d279b52262598a8c5759","user":{"login":"cloudant","id":44642,"avatar_url":"https://avatars.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"repo":{"id":22873328,"name":"java-cloudant","full_name":"cloudant/java-cloudant","owner":{"login":"cloudant","id":44642,"avatar_url":"https://avatars.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudant/java-cloudant","description":"A Java client for Cloudant","fork":false,"url":"https://api.github.com/repos/cloudant/java-cloudant","forks_url":"https://api.github.com/repos/cloudant/java-cloudant/forks","keys_url":"https://api.github.com/repos/cloudant/java-cloudant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudant/java-cloudant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudant/java-cloudant/teams","hooks_url":"https://api.github.com/repos/cloudant/java-cloudant/hooks","issue_events_url":"https://api.github.com/repos/cloudant/java-cloudant/issues/events{/number}","events_url":"https://api.github.com/repos/cloudant/java-cloudant/events","assignees_url":"https://api.github.com/repos/cloudant/java-cloudant/assignees{/user}","branches_url":"https://api.github.com/repos/cloudant/java-cloudant/branches{/branch}","tags_url":"https://api.github.com/repos/cloudant/java-cloudant/tags","blobs_url":"https://api.github.com/repos/cloudant/java-cloudant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudant/java-cloudant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudant/java-cloudant/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudant/java-cloudant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudant/java-cloudant/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudant/java-cloudant/languages","stargazers_url":"https://api.github.com/repos/cloudant/java-cloudant/stargazers","contributors_url":"https://api.github.com/repos/cloudant/java-cloudant/contributors","subscribers_url":"https://api.github.com/repos/cloudant/java-cloudant/subscribers","subscription_url":"https://api.github.com/repos/cloudant/java-cloudant/subscription","commits_url":"https://api.github.com/repos/cloudant/java-cloudant/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudant/java-cloudant/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudant/java-cloudant/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudant/java-cloudant/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudant/java-cloudant/contents/{+path}","compare_url":"https://api.github.com/repos/cloudant/java-cloudant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudant/java-cloudant/merges","archive_url":"https://api.github.com/repos/cloudant/java-cloudant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudant/java-cloudant/downloads","issues_url":"https://api.github.com/repos/cloudant/java-cloudant/issues{/number}","pulls_url":"https://api.github.com/repos/cloudant/java-cloudant/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudant/java-cloudant/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudant/java-cloudant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudant/java-cloudant/labels{/name}","releases_url":"https://api.github.com/repos/cloudant/java-cloudant/releases{/id}","created_at":"2014-08-12T10:19:56Z","updated_at":"2015-08-06T17:49:05Z","pushed_at":"2015-08-12T14:21:58Z","git_url":"git://github.com/cloudant/java-cloudant.git","ssh_url":"git@github.com:cloudant/java-cloudant.git","clone_url":"https://github.com/cloudant/java-cloudant.git","svn_url":"https://github.com/cloudant/java-cloudant","homepage":null,"size":3408,"stargazers_count":12,"watchers_count":12,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":11,"forks":13,"open_issues":11,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cloudant/java-cloudant/pulls/63"},"html":{"href":"https://github.com/cloudant/java-cloudant/pull/63"},"issue":{"href":"https://api.github.com/repos/cloudant/java-cloudant/issues/63"},"comments":{"href":"https://api.github.com/repos/cloudant/java-cloudant/issues/63/comments"},"review_comments":{"href":"https://api.github.com/repos/cloudant/java-cloudant/pulls/63/comments"},"review_comment":{"href":"https://api.github.com/repos/cloudant/java-cloudant/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cloudant/java-cloudant/pulls/63/commits"},"statuses":{"href":"https://api.github.com/repos/cloudant/java-cloudant/statuses/e75a2f17561476a2f7e46ebd4246a53738faa357"}}}}