{"action":"created","comment":{"url":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/comments/114526933","pull_request_review_id":35999083,"id":114526933,"diff_hunk":"@@ -167,11 +167,15 @@ class OperandsRemoval {\n       field = Object.keys(condition.value)[0];\n \n     if (operand.fields[field].count > 1) {\n-      const info = operand.fields[field].subfilters[subfilter.id];\n+      const info = operand.fields[field].subfilters[subfilter.id][condition.id];\n \n       operand.fields[field].tree.remove(info.low, info.high, info.subfilter);\n       operand.fields[field].count--;\n-      delete operand.fields[field].subfilters[subfilter.id];\n+      delete operand.fields[field].subfilters[subfilter.id][condition.id];\n+\n+      if (Object.keys(operand.fields[field].subfilters[subfilter.id]).length === 0) {\n+        delete operand.fields[field].subfilters[subfilter.id];\n+      }","path":"lib/api/dsl/storage/removeOperands.js","position":14,"original_position":14,"commit_id":"3b95434cc5fc97bf42bece25f6d0ad19cbcf7bcb","original_commit_id":"3b95434cc5fc97bf42bece25f6d0ad19cbcf7bcb","user":{"login":"scottinet","id":12997967,"avatar_url":"https://avatars3.githubusercontent.com/u/12997967?v=3","gravatar_id":"","url":"https://api.github.com/users/scottinet","html_url":"https://github.com/scottinet","followers_url":"https://api.github.com/users/scottinet/followers","following_url":"https://api.github.com/users/scottinet/following{/other_user}","gists_url":"https://api.github.com/users/scottinet/gists{/gist_id}","starred_url":"https://api.github.com/users/scottinet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottinet/subscriptions","organizations_url":"https://api.github.com/users/scottinet/orgs","repos_url":"https://api.github.com/users/scottinet/repos","events_url":"https://api.github.com/users/scottinet/events{/privacy}","received_events_url":"https://api.github.com/users/scottinet/received_events","type":"User","site_admin":false},"body":"There is an unnecessary deletion occuring if there is exactly 1 condition left in the structure: the condition deletion, and the subfilter one.\r\n\r\nThis can be prevented with the following code, replacing the lines 174-178:\r\n\r\n```js\r\n    if (Object.keys(operand.fields[field].subfilters[subfilter.id]).length === 1) {\r\n      delete operand.fields[field].subfilters[subfilter.id];\r\n    }\r\n    else {\r\n      delete operand.fields[field].subfilters[subfilter.id][condition.id];\r\n    }\r\n```\r\n","created_at":"2017-05-03T12:01:39Z","updated_at":"2017-05-03T12:03:00Z","html_url":"https://github.com/kuzzleio/kuzzle/pull/825#discussion_r114526933","pull_request_url":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/825","_links":{"self":{"href":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/comments/114526933"},"html":{"href":"https://github.com/kuzzleio/kuzzle/pull/825#discussion_r114526933"},"pull_request":{"href":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/825"}}},"pull_request":{"url":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/825","id":118590816,"html_url":"https://github.com/kuzzleio/kuzzle/pull/825","diff_url":"https://github.com/kuzzleio/kuzzle/pull/825.diff","patch_url":"https://github.com/kuzzleio/kuzzle/pull/825.patch","issue_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues/825","number":825,"state":"open","locked":false,"title":"Fix unhandled exception on unsubscribing multiple range operators","user":{"login":"benoitvidis","id":6680551,"avatar_url":"https://avatars0.githubusercontent.com/u/6680551?v=3","gravatar_id":"","url":"https://api.github.com/users/benoitvidis","html_url":"https://github.com/benoitvidis","followers_url":"https://api.github.com/users/benoitvidis/followers","following_url":"https://api.github.com/users/benoitvidis/following{/other_user}","gists_url":"https://api.github.com/users/benoitvidis/gists{/gist_id}","starred_url":"https://api.github.com/users/benoitvidis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benoitvidis/subscriptions","organizations_url":"https://api.github.com/users/benoitvidis/orgs","repos_url":"https://api.github.com/users/benoitvidis/repos","events_url":"https://api.github.com/users/benoitvidis/events{/privacy}","received_events_url":"https://api.github.com/users/benoitvidis/received_events","type":"User","site_admin":false},"body":"# Description\r\n\r\nThis PR fixes the case where after subscribing to a filter containing several `range` or `not range` conditions inside a `and` conditions, would crash Kuzzle on deregistering the filter.\r\n\r\n# Related issue\r\n\r\n* #824 ","created_at":"2017-05-02T16:11:03Z","updated_at":"2017-05-03T12:03:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7ab12f2f5f9f0ec14361ad0085a93fddfa5396d1","assignee":{"login":"benoitvidis","id":6680551,"avatar_url":"https://avatars0.githubusercontent.com/u/6680551?v=3","gravatar_id":"","url":"https://api.github.com/users/benoitvidis","html_url":"https://github.com/benoitvidis","followers_url":"https://api.github.com/users/benoitvidis/followers","following_url":"https://api.github.com/users/benoitvidis/following{/other_user}","gists_url":"https://api.github.com/users/benoitvidis/gists{/gist_id}","starred_url":"https://api.github.com/users/benoitvidis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benoitvidis/subscriptions","organizations_url":"https://api.github.com/users/benoitvidis/orgs","repos_url":"https://api.github.com/users/benoitvidis/repos","events_url":"https://api.github.com/users/benoitvidis/events{/privacy}","received_events_url":"https://api.github.com/users/benoitvidis/received_events","type":"User","site_admin":false},"assignees":[{"login":"benoitvidis","id":6680551,"avatar_url":"https://avatars0.githubusercontent.com/u/6680551?v=3","gravatar_id":"","url":"https://api.github.com/users/benoitvidis","html_url":"https://github.com/benoitvidis","followers_url":"https://api.github.com/users/benoitvidis/followers","following_url":"https://api.github.com/users/benoitvidis/following{/other_user}","gists_url":"https://api.github.com/users/benoitvidis/gists{/gist_id}","starred_url":"https://api.github.com/users/benoitvidis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benoitvidis/subscriptions","organizations_url":"https://api.github.com/users/benoitvidis/orgs","repos_url":"https://api.github.com/users/benoitvidis/repos","events_url":"https://api.github.com/users/benoitvidis/events{/privacy}","received_events_url":"https://api.github.com/users/benoitvidis/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/825/commits","review_comments_url":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/825/comments","review_comment_url":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues/825/comments","statuses_url":"https://api.github.com/repos/kuzzleio/kuzzle/statuses/3b95434cc5fc97bf42bece25f6d0ad19cbcf7bcb","head":{"label":"kuzzleio:fix-824-range-error-on-unsubscribe","ref":"fix-824-range-error-on-unsubscribe","sha":"3b95434cc5fc97bf42bece25f6d0ad19cbcf7bcb","user":{"login":"kuzzleio","id":12933347,"avatar_url":"https://avatars2.githubusercontent.com/u/12933347?v=3","gravatar_id":"","url":"https://api.github.com/users/kuzzleio","html_url":"https://github.com/kuzzleio","followers_url":"https://api.github.com/users/kuzzleio/followers","following_url":"https://api.github.com/users/kuzzleio/following{/other_user}","gists_url":"https://api.github.com/users/kuzzleio/gists{/gist_id}","starred_url":"https://api.github.com/users/kuzzleio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuzzleio/subscriptions","organizations_url":"https://api.github.com/users/kuzzleio/orgs","repos_url":"https://api.github.com/users/kuzzleio/repos","events_url":"https://api.github.com/users/kuzzleio/events{/privacy}","received_events_url":"https://api.github.com/users/kuzzleio/received_events","type":"Organization","site_admin":false},"repo":{"id":41084349,"name":"kuzzle","full_name":"kuzzleio/kuzzle","owner":{"login":"kuzzleio","id":12933347,"avatar_url":"https://avatars2.githubusercontent.com/u/12933347?v=3","gravatar_id":"","url":"https://api.github.com/users/kuzzleio","html_url":"https://github.com/kuzzleio","followers_url":"https://api.github.com/users/kuzzleio/followers","following_url":"https://api.github.com/users/kuzzleio/following{/other_user}","gists_url":"https://api.github.com/users/kuzzleio/gists{/gist_id}","starred_url":"https://api.github.com/users/kuzzleio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuzzleio/subscriptions","organizations_url":"https://api.github.com/users/kuzzleio/orgs","repos_url":"https://api.github.com/users/kuzzleio/repos","events_url":"https://api.github.com/users/kuzzleio/events{/privacy}","received_events_url":"https://api.github.com/users/kuzzleio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kuzzleio/kuzzle","description":"Open-source Back-end, self-hostable & ready to use - Real-time, storage, advanced search - Web, Apps, Mobile, IoT -","fork":false,"url":"https://api.github.com/repos/kuzzleio/kuzzle","forks_url":"https://api.github.com/repos/kuzzleio/kuzzle/forks","keys_url":"https://api.github.com/repos/kuzzleio/kuzzle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kuzzleio/kuzzle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kuzzleio/kuzzle/teams","hooks_url":"https://api.github.com/repos/kuzzleio/kuzzle/hooks","issue_events_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues/events{/number}","events_url":"https://api.github.com/repos/kuzzleio/kuzzle/events","assignees_url":"https://api.github.com/repos/kuzzleio/kuzzle/assignees{/user}","branches_url":"https://api.github.com/repos/kuzzleio/kuzzle/branches{/branch}","tags_url":"https://api.github.com/repos/kuzzleio/kuzzle/tags","blobs_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/refs{/sha}","trees_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kuzzleio/kuzzle/statuses/{sha}","languages_url":"https://api.github.com/repos/kuzzleio/kuzzle/languages","stargazers_url":"https://api.github.com/repos/kuzzleio/kuzzle/stargazers","contributors_url":"https://api.github.com/repos/kuzzleio/kuzzle/contributors","subscribers_url":"https://api.github.com/repos/kuzzleio/kuzzle/subscribers","subscription_url":"https://api.github.com/repos/kuzzleio/kuzzle/subscription","commits_url":"https://api.github.com/repos/kuzzleio/kuzzle/commits{/sha}","git_commits_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/commits{/sha}","comments_url":"https://api.github.com/repos/kuzzleio/kuzzle/comments{/number}","issue_comment_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues/comments{/number}","contents_url":"https://api.github.com/repos/kuzzleio/kuzzle/contents/{+path}","compare_url":"https://api.github.com/repos/kuzzleio/kuzzle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kuzzleio/kuzzle/merges","archive_url":"https://api.github.com/repos/kuzzleio/kuzzle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kuzzleio/kuzzle/downloads","issues_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues{/number}","pulls_url":"https://api.github.com/repos/kuzzleio/kuzzle/pulls{/number}","milestones_url":"https://api.github.com/repos/kuzzleio/kuzzle/milestones{/number}","notifications_url":"https://api.github.com/repos/kuzzleio/kuzzle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kuzzleio/kuzzle/labels{/name}","releases_url":"https://api.github.com/repos/kuzzleio/kuzzle/releases{/id}","deployments_url":"https://api.github.com/repos/kuzzleio/kuzzle/deployments","created_at":"2015-08-20T08:26:57Z","updated_at":"2017-05-01T17:59:57Z","pushed_at":"2017-05-03T10:28:44Z","git_url":"git://github.com/kuzzleio/kuzzle.git","ssh_url":"git@github.com:kuzzleio/kuzzle.git","clone_url":"https://github.com/kuzzleio/kuzzle.git","svn_url":"https://github.com/kuzzleio/kuzzle","homepage":"http://kuzzle.io","size":10969,"stargazers_count":424,"watchers_count":424,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":32,"mirror_url":null,"open_issues_count":101,"forks":32,"open_issues":101,"watchers":424,"default_branch":"master"}},"base":{"label":"kuzzleio:rc.x","ref":"rc.x","sha":"301e1c3000be8d69dc8d32a1c949d02d2db29526","user":{"login":"kuzzleio","id":12933347,"avatar_url":"https://avatars2.githubusercontent.com/u/12933347?v=3","gravatar_id":"","url":"https://api.github.com/users/kuzzleio","html_url":"https://github.com/kuzzleio","followers_url":"https://api.github.com/users/kuzzleio/followers","following_url":"https://api.github.com/users/kuzzleio/following{/other_user}","gists_url":"https://api.github.com/users/kuzzleio/gists{/gist_id}","starred_url":"https://api.github.com/users/kuzzleio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuzzleio/subscriptions","organizations_url":"https://api.github.com/users/kuzzleio/orgs","repos_url":"https://api.github.com/users/kuzzleio/repos","events_url":"https://api.github.com/users/kuzzleio/events{/privacy}","received_events_url":"https://api.github.com/users/kuzzleio/received_events","type":"Organization","site_admin":false},"repo":{"id":41084349,"name":"kuzzle","full_name":"kuzzleio/kuzzle","owner":{"login":"kuzzleio","id":12933347,"avatar_url":"https://avatars2.githubusercontent.com/u/12933347?v=3","gravatar_id":"","url":"https://api.github.com/users/kuzzleio","html_url":"https://github.com/kuzzleio","followers_url":"https://api.github.com/users/kuzzleio/followers","following_url":"https://api.github.com/users/kuzzleio/following{/other_user}","gists_url":"https://api.github.com/users/kuzzleio/gists{/gist_id}","starred_url":"https://api.github.com/users/kuzzleio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuzzleio/subscriptions","organizations_url":"https://api.github.com/users/kuzzleio/orgs","repos_url":"https://api.github.com/users/kuzzleio/repos","events_url":"https://api.github.com/users/kuzzleio/events{/privacy}","received_events_url":"https://api.github.com/users/kuzzleio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kuzzleio/kuzzle","description":"Open-source Back-end, self-hostable & ready to use - Real-time, storage, advanced search - Web, Apps, Mobile, IoT -","fork":false,"url":"https://api.github.com/repos/kuzzleio/kuzzle","forks_url":"https://api.github.com/repos/kuzzleio/kuzzle/forks","keys_url":"https://api.github.com/repos/kuzzleio/kuzzle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kuzzleio/kuzzle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kuzzleio/kuzzle/teams","hooks_url":"https://api.github.com/repos/kuzzleio/kuzzle/hooks","issue_events_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues/events{/number}","events_url":"https://api.github.com/repos/kuzzleio/kuzzle/events","assignees_url":"https://api.github.com/repos/kuzzleio/kuzzle/assignees{/user}","branches_url":"https://api.github.com/repos/kuzzleio/kuzzle/branches{/branch}","tags_url":"https://api.github.com/repos/kuzzleio/kuzzle/tags","blobs_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/refs{/sha}","trees_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kuzzleio/kuzzle/statuses/{sha}","languages_url":"https://api.github.com/repos/kuzzleio/kuzzle/languages","stargazers_url":"https://api.github.com/repos/kuzzleio/kuzzle/stargazers","contributors_url":"https://api.github.com/repos/kuzzleio/kuzzle/contributors","subscribers_url":"https://api.github.com/repos/kuzzleio/kuzzle/subscribers","subscription_url":"https://api.github.com/repos/kuzzleio/kuzzle/subscription","commits_url":"https://api.github.com/repos/kuzzleio/kuzzle/commits{/sha}","git_commits_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/commits{/sha}","comments_url":"https://api.github.com/repos/kuzzleio/kuzzle/comments{/number}","issue_comment_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues/comments{/number}","contents_url":"https://api.github.com/repos/kuzzleio/kuzzle/contents/{+path}","compare_url":"https://api.github.com/repos/kuzzleio/kuzzle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kuzzleio/kuzzle/merges","archive_url":"https://api.github.com/repos/kuzzleio/kuzzle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kuzzleio/kuzzle/downloads","issues_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues{/number}","pulls_url":"https://api.github.com/repos/kuzzleio/kuzzle/pulls{/number}","milestones_url":"https://api.github.com/repos/kuzzleio/kuzzle/milestones{/number}","notifications_url":"https://api.github.com/repos/kuzzleio/kuzzle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kuzzleio/kuzzle/labels{/name}","releases_url":"https://api.github.com/repos/kuzzleio/kuzzle/releases{/id}","deployments_url":"https://api.github.com/repos/kuzzleio/kuzzle/deployments","created_at":"2015-08-20T08:26:57Z","updated_at":"2017-05-01T17:59:57Z","pushed_at":"2017-05-03T10:28:44Z","git_url":"git://github.com/kuzzleio/kuzzle.git","ssh_url":"git@github.com:kuzzleio/kuzzle.git","clone_url":"https://github.com/kuzzleio/kuzzle.git","svn_url":"https://github.com/kuzzleio/kuzzle","homepage":"http://kuzzle.io","size":10969,"stargazers_count":424,"watchers_count":424,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":32,"mirror_url":null,"open_issues_count":101,"forks":32,"open_issues":101,"watchers":424,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/825"},"html":{"href":"https://github.com/kuzzleio/kuzzle/pull/825"},"issue":{"href":"https://api.github.com/repos/kuzzleio/kuzzle/issues/825"},"comments":{"href":"https://api.github.com/repos/kuzzleio/kuzzle/issues/825/comments"},"review_comments":{"href":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/825/comments"},"review_comment":{"href":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/825/commits"},"statuses":{"href":"https://api.github.com/repos/kuzzleio/kuzzle/statuses/3b95434cc5fc97bf42bece25f6d0ad19cbcf7bcb"}}}}
{"actor":{"display_login":"scottinet"}}