{"action":"created","comment":{"url":"https://api.github.com/repos/inaka/sumo_db/pulls/comments/54157772","id":54157772,"diff_hunk":"@@ -228,10 +228,12 @@ find_by(DocName, Conditions, State) ->\n ) -> sumo_store:result([sumo_internal:doc()], state()).\n find_by(DocName, Conditions, Limit, Offset, State) when is_list(Conditions) ->\n   IdField = sumo_internal:id_field_name(DocName),\n-  %% If the key field is present in the conditions, we are looking for a\n-  %% particular document. If not, it is a general query.\n-  case lists:keyfind(IdField, 1, Conditions) of\n-    {_K, Key} ->\n+  %% If **ONLY** the key field is present in the conditions, we are looking\n+  %% for a particular document. Otherwise, it is a general query.\n+  IdFieldFound = lists:keymember(IdField, 1, Conditions),\n+  case {IdFieldFound, length(Conditions)} of","path":"src/sumo_store_riak.erl","position":11,"original_position":11,"commit_id":"29bbad86d2765a987b41f206880ccd29359aeb8f","original_commit_id":"29bbad86d2765a987b41f206880ccd29359aeb8f","user":{"login":"elbrujohalcon","id":93657,"avatar_url":"https://avatars.githubusercontent.com/u/93657?v=3","gravatar_id":"","url":"https://api.github.com/users/elbrujohalcon","html_url":"https://github.com/elbrujohalcon","followers_url":"https://api.github.com/users/elbrujohalcon/followers","following_url":"https://api.github.com/users/elbrujohalcon/following{/other_user}","gists_url":"https://api.github.com/users/elbrujohalcon/gists{/gist_id}","starred_url":"https://api.github.com/users/elbrujohalcon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elbrujohalcon/subscriptions","organizations_url":"https://api.github.com/users/elbrujohalcon/orgs","repos_url":"https://api.github.com/users/elbrujohalcon/repos","events_url":"https://api.github.com/users/elbrujohalcon/events{/privacy}","received_events_url":"https://api.github.com/users/elbrujohalcon/received_events","type":"User","site_admin":false},"body":"would it be possible to do…\r\n```erlang\r\ncase Conditions of\r\n  [{IdField, Value}] -> …\r\n```","created_at":"2016-02-25T20:20:39Z","updated_at":"2016-02-25T20:20:39Z","html_url":"https://github.com/inaka/sumo_db/pull/231#discussion_r54157772","pull_request_url":"https://api.github.com/repos/inaka/sumo_db/pulls/231","_links":{"self":{"href":"https://api.github.com/repos/inaka/sumo_db/pulls/comments/54157772"},"html":{"href":"https://github.com/inaka/sumo_db/pull/231#discussion_r54157772"},"pull_request":{"href":"https://api.github.com/repos/inaka/sumo_db/pulls/231"}}},"pull_request":{"url":"https://api.github.com/repos/inaka/sumo_db/pulls/231","id":60740247,"html_url":"https://github.com/inaka/sumo_db/pull/231","diff_url":"https://github.com/inaka/sumo_db/pull/231.diff","patch_url":"https://github.com/inaka/sumo_db/pull/231.patch","issue_url":"https://api.github.com/repos/inaka/sumo_db/issues/231","number":231,"state":"open","locked":false,"title":"[#192] Make Riak store take care of every condition when building the query","user":{"login":"harenson","id":216031,"avatar_url":"https://avatars.githubusercontent.com/u/216031?v=3","gravatar_id":"","url":"https://api.github.com/users/harenson","html_url":"https://github.com/harenson","followers_url":"https://api.github.com/users/harenson/followers","following_url":"https://api.github.com/users/harenson/following{/other_user}","gists_url":"https://api.github.com/users/harenson/gists{/gist_id}","starred_url":"https://api.github.com/users/harenson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harenson/subscriptions","organizations_url":"https://api.github.com/users/harenson/orgs","repos_url":"https://api.github.com/users/harenson/repos","events_url":"https://api.github.com/users/harenson/events{/privacy}","received_events_url":"https://api.github.com/users/harenson/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-25T20:17:35Z","updated_at":"2016-02-25T20:20:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"833deb582db23ea5e4a666d479b34bae2c23de23","assignee":{"login":"elbrujohalcon","id":93657,"avatar_url":"https://avatars.githubusercontent.com/u/93657?v=3","gravatar_id":"","url":"https://api.github.com/users/elbrujohalcon","html_url":"https://github.com/elbrujohalcon","followers_url":"https://api.github.com/users/elbrujohalcon/followers","following_url":"https://api.github.com/users/elbrujohalcon/following{/other_user}","gists_url":"https://api.github.com/users/elbrujohalcon/gists{/gist_id}","starred_url":"https://api.github.com/users/elbrujohalcon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elbrujohalcon/subscriptions","organizations_url":"https://api.github.com/users/elbrujohalcon/orgs","repos_url":"https://api.github.com/users/elbrujohalcon/repos","events_url":"https://api.github.com/users/elbrujohalcon/events{/privacy}","received_events_url":"https://api.github.com/users/elbrujohalcon/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/inaka/sumo_db/pulls/231/commits","review_comments_url":"https://api.github.com/repos/inaka/sumo_db/pulls/231/comments","review_comment_url":"https://api.github.com/repos/inaka/sumo_db/pulls/comments{/number}","comments_url":"https://api.github.com/repos/inaka/sumo_db/issues/231/comments","statuses_url":"https://api.github.com/repos/inaka/sumo_db/statuses/29bbad86d2765a987b41f206880ccd29359aeb8f","head":{"label":"inaka:harenson.192.riak-is-not-correctly-matching-by-id","ref":"harenson.192.riak-is-not-correctly-matching-by-id","sha":"29bbad86d2765a987b41f206880ccd29359aeb8f","user":{"login":"inaka","id":867053,"avatar_url":"https://avatars.githubusercontent.com/u/867053?v=3","gravatar_id":"","url":"https://api.github.com/users/inaka","html_url":"https://github.com/inaka","followers_url":"https://api.github.com/users/inaka/followers","following_url":"https://api.github.com/users/inaka/following{/other_user}","gists_url":"https://api.github.com/users/inaka/gists{/gist_id}","starred_url":"https://api.github.com/users/inaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inaka/subscriptions","organizations_url":"https://api.github.com/users/inaka/orgs","repos_url":"https://api.github.com/users/inaka/repos","events_url":"https://api.github.com/users/inaka/events{/privacy}","received_events_url":"https://api.github.com/users/inaka/received_events","type":"Organization","site_admin":false},"repo":{"id":11457919,"name":"sumo_db","full_name":"inaka/sumo_db","owner":{"login":"inaka","id":867053,"avatar_url":"https://avatars.githubusercontent.com/u/867053?v=3","gravatar_id":"","url":"https://api.github.com/users/inaka","html_url":"https://github.com/inaka","followers_url":"https://api.github.com/users/inaka/followers","following_url":"https://api.github.com/users/inaka/following{/other_user}","gists_url":"https://api.github.com/users/inaka/gists{/gist_id}","starred_url":"https://api.github.com/users/inaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inaka/subscriptions","organizations_url":"https://api.github.com/users/inaka/orgs","repos_url":"https://api.github.com/users/inaka/repos","events_url":"https://api.github.com/users/inaka/events{/privacy}","received_events_url":"https://api.github.com/users/inaka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/inaka/sumo_db","description":"Erlang Persistency Framework","fork":false,"url":"https://api.github.com/repos/inaka/sumo_db","forks_url":"https://api.github.com/repos/inaka/sumo_db/forks","keys_url":"https://api.github.com/repos/inaka/sumo_db/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inaka/sumo_db/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inaka/sumo_db/teams","hooks_url":"https://api.github.com/repos/inaka/sumo_db/hooks","issue_events_url":"https://api.github.com/repos/inaka/sumo_db/issues/events{/number}","events_url":"https://api.github.com/repos/inaka/sumo_db/events","assignees_url":"https://api.github.com/repos/inaka/sumo_db/assignees{/user}","branches_url":"https://api.github.com/repos/inaka/sumo_db/branches{/branch}","tags_url":"https://api.github.com/repos/inaka/sumo_db/tags","blobs_url":"https://api.github.com/repos/inaka/sumo_db/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inaka/sumo_db/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inaka/sumo_db/git/refs{/sha}","trees_url":"https://api.github.com/repos/inaka/sumo_db/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inaka/sumo_db/statuses/{sha}","languages_url":"https://api.github.com/repos/inaka/sumo_db/languages","stargazers_url":"https://api.github.com/repos/inaka/sumo_db/stargazers","contributors_url":"https://api.github.com/repos/inaka/sumo_db/contributors","subscribers_url":"https://api.github.com/repos/inaka/sumo_db/subscribers","subscription_url":"https://api.github.com/repos/inaka/sumo_db/subscription","commits_url":"https://api.github.com/repos/inaka/sumo_db/commits{/sha}","git_commits_url":"https://api.github.com/repos/inaka/sumo_db/git/commits{/sha}","comments_url":"https://api.github.com/repos/inaka/sumo_db/comments{/number}","issue_comment_url":"https://api.github.com/repos/inaka/sumo_db/issues/comments{/number}","contents_url":"https://api.github.com/repos/inaka/sumo_db/contents/{+path}","compare_url":"https://api.github.com/repos/inaka/sumo_db/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inaka/sumo_db/merges","archive_url":"https://api.github.com/repos/inaka/sumo_db/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inaka/sumo_db/downloads","issues_url":"https://api.github.com/repos/inaka/sumo_db/issues{/number}","pulls_url":"https://api.github.com/repos/inaka/sumo_db/pulls{/number}","milestones_url":"https://api.github.com/repos/inaka/sumo_db/milestones{/number}","notifications_url":"https://api.github.com/repos/inaka/sumo_db/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inaka/sumo_db/labels{/name}","releases_url":"https://api.github.com/repos/inaka/sumo_db/releases{/id}","deployments_url":"https://api.github.com/repos/inaka/sumo_db/deployments","created_at":"2013-07-16T19:15:37Z","updated_at":"2016-02-20T03:35:59Z","pushed_at":"2016-02-25T20:17:35Z","git_url":"git://github.com/inaka/sumo_db.git","ssh_url":"git@github.com:inaka/sumo_db.git","clone_url":"https://github.com/inaka/sumo_db.git","svn_url":"https://github.com/inaka/sumo_db","homepage":"http://inaka.github.io/sumo_db/","size":1056,"stargazers_count":86,"watchers_count":86,"language":"Erlang","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":16,"mirror_url":null,"open_issues_count":38,"forks":16,"open_issues":38,"watchers":86,"default_branch":"master"}},"base":{"label":"inaka:master","ref":"master","sha":"0c51a27698cc2c5bbb632dbe3be36504f6dca132","user":{"login":"inaka","id":867053,"avatar_url":"https://avatars.githubusercontent.com/u/867053?v=3","gravatar_id":"","url":"https://api.github.com/users/inaka","html_url":"https://github.com/inaka","followers_url":"https://api.github.com/users/inaka/followers","following_url":"https://api.github.com/users/inaka/following{/other_user}","gists_url":"https://api.github.com/users/inaka/gists{/gist_id}","starred_url":"https://api.github.com/users/inaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inaka/subscriptions","organizations_url":"https://api.github.com/users/inaka/orgs","repos_url":"https://api.github.com/users/inaka/repos","events_url":"https://api.github.com/users/inaka/events{/privacy}","received_events_url":"https://api.github.com/users/inaka/received_events","type":"Organization","site_admin":false},"repo":{"id":11457919,"name":"sumo_db","full_name":"inaka/sumo_db","owner":{"login":"inaka","id":867053,"avatar_url":"https://avatars.githubusercontent.com/u/867053?v=3","gravatar_id":"","url":"https://api.github.com/users/inaka","html_url":"https://github.com/inaka","followers_url":"https://api.github.com/users/inaka/followers","following_url":"https://api.github.com/users/inaka/following{/other_user}","gists_url":"https://api.github.com/users/inaka/gists{/gist_id}","starred_url":"https://api.github.com/users/inaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inaka/subscriptions","organizations_url":"https://api.github.com/users/inaka/orgs","repos_url":"https://api.github.com/users/inaka/repos","events_url":"https://api.github.com/users/inaka/events{/privacy}","received_events_url":"https://api.github.com/users/inaka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/inaka/sumo_db","description":"Erlang Persistency Framework","fork":false,"url":"https://api.github.com/repos/inaka/sumo_db","forks_url":"https://api.github.com/repos/inaka/sumo_db/forks","keys_url":"https://api.github.com/repos/inaka/sumo_db/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inaka/sumo_db/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inaka/sumo_db/teams","hooks_url":"https://api.github.com/repos/inaka/sumo_db/hooks","issue_events_url":"https://api.github.com/repos/inaka/sumo_db/issues/events{/number}","events_url":"https://api.github.com/repos/inaka/sumo_db/events","assignees_url":"https://api.github.com/repos/inaka/sumo_db/assignees{/user}","branches_url":"https://api.github.com/repos/inaka/sumo_db/branches{/branch}","tags_url":"https://api.github.com/repos/inaka/sumo_db/tags","blobs_url":"https://api.github.com/repos/inaka/sumo_db/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inaka/sumo_db/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inaka/sumo_db/git/refs{/sha}","trees_url":"https://api.github.com/repos/inaka/sumo_db/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inaka/sumo_db/statuses/{sha}","languages_url":"https://api.github.com/repos/inaka/sumo_db/languages","stargazers_url":"https://api.github.com/repos/inaka/sumo_db/stargazers","contributors_url":"https://api.github.com/repos/inaka/sumo_db/contributors","subscribers_url":"https://api.github.com/repos/inaka/sumo_db/subscribers","subscription_url":"https://api.github.com/repos/inaka/sumo_db/subscription","commits_url":"https://api.github.com/repos/inaka/sumo_db/commits{/sha}","git_commits_url":"https://api.github.com/repos/inaka/sumo_db/git/commits{/sha}","comments_url":"https://api.github.com/repos/inaka/sumo_db/comments{/number}","issue_comment_url":"https://api.github.com/repos/inaka/sumo_db/issues/comments{/number}","contents_url":"https://api.github.com/repos/inaka/sumo_db/contents/{+path}","compare_url":"https://api.github.com/repos/inaka/sumo_db/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inaka/sumo_db/merges","archive_url":"https://api.github.com/repos/inaka/sumo_db/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inaka/sumo_db/downloads","issues_url":"https://api.github.com/repos/inaka/sumo_db/issues{/number}","pulls_url":"https://api.github.com/repos/inaka/sumo_db/pulls{/number}","milestones_url":"https://api.github.com/repos/inaka/sumo_db/milestones{/number}","notifications_url":"https://api.github.com/repos/inaka/sumo_db/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inaka/sumo_db/labels{/name}","releases_url":"https://api.github.com/repos/inaka/sumo_db/releases{/id}","deployments_url":"https://api.github.com/repos/inaka/sumo_db/deployments","created_at":"2013-07-16T19:15:37Z","updated_at":"2016-02-20T03:35:59Z","pushed_at":"2016-02-25T20:17:35Z","git_url":"git://github.com/inaka/sumo_db.git","ssh_url":"git@github.com:inaka/sumo_db.git","clone_url":"https://github.com/inaka/sumo_db.git","svn_url":"https://github.com/inaka/sumo_db","homepage":"http://inaka.github.io/sumo_db/","size":1056,"stargazers_count":86,"watchers_count":86,"language":"Erlang","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":16,"mirror_url":null,"open_issues_count":38,"forks":16,"open_issues":38,"watchers":86,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/inaka/sumo_db/pulls/231"},"html":{"href":"https://github.com/inaka/sumo_db/pull/231"},"issue":{"href":"https://api.github.com/repos/inaka/sumo_db/issues/231"},"comments":{"href":"https://api.github.com/repos/inaka/sumo_db/issues/231/comments"},"review_comments":{"href":"https://api.github.com/repos/inaka/sumo_db/pulls/231/comments"},"review_comment":{"href":"https://api.github.com/repos/inaka/sumo_db/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/inaka/sumo_db/pulls/231/commits"},"statuses":{"href":"https://api.github.com/repos/inaka/sumo_db/statuses/29bbad86d2765a987b41f206880ccd29359aeb8f"}}}}