{"action":"created","comment":{"url":"https://api.github.com/repos/openannotation/annotator-store/pulls/comments/25400833","id":25400833,"diff_hunk":"@@ -96,8 +96,28 @@ def _build_query(cls, query=None, offset=None, limit=None, sort=None, order=None\n         if query is None:\n             query = {}\n \n+        # Pop 'before' and 'after' parameters out of the query\n+        after = query.pop('after', None)\n+        before = query.pop('before', None)\n+\n         q = super(Annotation, cls)._build_query(query, offset, limit, sort, order)\n \n+        # Create range query from before and/or after\n+        if before or after:\n+            clauses = q['query']['bool']['must']\n+\n+            # Remove match_all conjunction, because\n+            # a range clause is added\n+            if clauses[0] == {'match_all': {}}:","path":"annotator/annotation.py","position":16,"original_position":16,"commit_id":"0182a1615a1cb6f0a4df9b4d7c00a81199fa072f","original_commit_id":"0182a1615a1cb6f0a4df9b4d7c00a81199fa072f","user":{"login":"tilgovi","id":20818,"avatar_url":"https://avatars.githubusercontent.com/u/20818?v=3","gravatar_id":"","url":"https://api.github.com/users/tilgovi","html_url":"https://github.com/tilgovi","followers_url":"https://api.github.com/users/tilgovi/followers","following_url":"https://api.github.com/users/tilgovi/following{/other_user}","gists_url":"https://api.github.com/users/tilgovi/gists{/gist_id}","starred_url":"https://api.github.com/users/tilgovi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tilgovi/subscriptions","organizations_url":"https://api.github.com/users/tilgovi/orgs","repos_url":"https://api.github.com/users/tilgovi/repos","events_url":"https://api.github.com/users/tilgovi/events{/privacy}","received_events_url":"https://api.github.com/users/tilgovi/received_events","type":"User","site_admin":false},"body":"Can you explain this part?","created_at":"2015-02-26T02:39:49Z","updated_at":"2015-02-26T02:39:49Z","html_url":"https://github.com/openannotation/annotator-store/pull/118#discussion_r25400833","pull_request_url":"https://api.github.com/repos/openannotation/annotator-store/pulls/118","_links":{"self":{"href":"https://api.github.com/repos/openannotation/annotator-store/pulls/comments/25400833"},"html":{"href":"https://github.com/openannotation/annotator-store/pull/118#discussion_r25400833"},"pull_request":{"href":"https://api.github.com/repos/openannotation/annotator-store/pulls/118"}}},"pull_request":{"url":"https://api.github.com/repos/openannotation/annotator-store/pulls/118","id":29907233,"html_url":"https://github.com/openannotation/annotator-store/pull/118","diff_url":"https://github.com/openannotation/annotator-store/pull/118.diff","patch_url":"https://github.com/openannotation/annotator-store/pull/118.patch","issue_url":"https://api.github.com/repos/openannotation/annotator-store/issues/118","number":118,"state":"open","locked":false,"title":"Introduce before and after parameters for search queries","user":{"login":"gergely-ujvari","id":2094134,"avatar_url":"https://avatars.githubusercontent.com/u/2094134?v=3","gravatar_id":"","url":"https://api.github.com/users/gergely-ujvari","html_url":"https://github.com/gergely-ujvari","followers_url":"https://api.github.com/users/gergely-ujvari/followers","following_url":"https://api.github.com/users/gergely-ujvari/following{/other_user}","gists_url":"https://api.github.com/users/gergely-ujvari/gists{/gist_id}","starred_url":"https://api.github.com/users/gergely-ujvari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gergely-ujvari/subscriptions","organizations_url":"https://api.github.com/users/gergely-ujvari/orgs","repos_url":"https://api.github.com/users/gergely-ujvari/repos","events_url":"https://api.github.com/users/gergely-ujvari/events{/privacy}","received_events_url":"https://api.github.com/users/gergely-ujvari/received_events","type":"User","site_admin":false},"body":"This PR gives the ability to retrieve annotations created within a time interval.\r\nFor this the `before` and `after` search parameters are introduced to form a range query.\r\n","created_at":"2015-02-24T15:36:32Z","updated_at":"2015-02-26T02:39:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"382f4d2c2b8899000253891fbb839ea41fb46515","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openannotation/annotator-store/pulls/118/commits","review_comments_url":"https://api.github.com/repos/openannotation/annotator-store/pulls/118/comments","review_comment_url":"https://api.github.com/repos/openannotation/annotator-store/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openannotation/annotator-store/issues/118/comments","statuses_url":"https://api.github.com/repos/openannotation/annotator-store/statuses/0182a1615a1cb6f0a4df9b4d7c00a81199fa072f","head":{"label":"openannotation:introduce-from-and-to-search-params","ref":"introduce-from-and-to-search-params","sha":"0182a1615a1cb6f0a4df9b4d7c00a81199fa072f","user":{"login":"openannotation","id":3476110,"avatar_url":"https://avatars.githubusercontent.com/u/3476110?v=3","gravatar_id":"","url":"https://api.github.com/users/openannotation","html_url":"https://github.com/openannotation","followers_url":"https://api.github.com/users/openannotation/followers","following_url":"https://api.github.com/users/openannotation/following{/other_user}","gists_url":"https://api.github.com/users/openannotation/gists{/gist_id}","starred_url":"https://api.github.com/users/openannotation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openannotation/subscriptions","organizations_url":"https://api.github.com/users/openannotation/orgs","repos_url":"https://api.github.com/users/openannotation/repos","events_url":"https://api.github.com/users/openannotation/events{/privacy}","received_events_url":"https://api.github.com/users/openannotation/received_events","type":"Organization","site_admin":false},"repo":{"id":1397272,"name":"annotator-store","full_name":"openannotation/annotator-store","owner":{"login":"openannotation","id":3476110,"avatar_url":"https://avatars.githubusercontent.com/u/3476110?v=3","gravatar_id":"","url":"https://api.github.com/users/openannotation","html_url":"https://github.com/openannotation","followers_url":"https://api.github.com/users/openannotation/followers","following_url":"https://api.github.com/users/openannotation/following{/other_user}","gists_url":"https://api.github.com/users/openannotation/gists{/gist_id}","starred_url":"https://api.github.com/users/openannotation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openannotation/subscriptions","organizations_url":"https://api.github.com/users/openannotation/orgs","repos_url":"https://api.github.com/users/openannotation/repos","events_url":"https://api.github.com/users/openannotation/events{/privacy}","received_events_url":"https://api.github.com/users/openannotation/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openannotation/annotator-store","description":"A backend store for the Annotator","fork":false,"url":"https://api.github.com/repos/openannotation/annotator-store","forks_url":"https://api.github.com/repos/openannotation/annotator-store/forks","keys_url":"https://api.github.com/repos/openannotation/annotator-store/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openannotation/annotator-store/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openannotation/annotator-store/teams","hooks_url":"https://api.github.com/repos/openannotation/annotator-store/hooks","issue_events_url":"https://api.github.com/repos/openannotation/annotator-store/issues/events{/number}","events_url":"https://api.github.com/repos/openannotation/annotator-store/events","assignees_url":"https://api.github.com/repos/openannotation/annotator-store/assignees{/user}","branches_url":"https://api.github.com/repos/openannotation/annotator-store/branches{/branch}","tags_url":"https://api.github.com/repos/openannotation/annotator-store/tags","blobs_url":"https://api.github.com/repos/openannotation/annotator-store/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openannotation/annotator-store/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openannotation/annotator-store/git/refs{/sha}","trees_url":"https://api.github.com/repos/openannotation/annotator-store/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openannotation/annotator-store/statuses/{sha}","languages_url":"https://api.github.com/repos/openannotation/annotator-store/languages","stargazers_url":"https://api.github.com/repos/openannotation/annotator-store/stargazers","contributors_url":"https://api.github.com/repos/openannotation/annotator-store/contributors","subscribers_url":"https://api.github.com/repos/openannotation/annotator-store/subscribers","subscription_url":"https://api.github.com/repos/openannotation/annotator-store/subscription","commits_url":"https://api.github.com/repos/openannotation/annotator-store/commits{/sha}","git_commits_url":"https://api.github.com/repos/openannotation/annotator-store/git/commits{/sha}","comments_url":"https://api.github.com/repos/openannotation/annotator-store/comments{/number}","issue_comment_url":"https://api.github.com/repos/openannotation/annotator-store/issues/comments{/number}","contents_url":"https://api.github.com/repos/openannotation/annotator-store/contents/{+path}","compare_url":"https://api.github.com/repos/openannotation/annotator-store/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openannotation/annotator-store/merges","archive_url":"https://api.github.com/repos/openannotation/annotator-store/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openannotation/annotator-store/downloads","issues_url":"https://api.github.com/repos/openannotation/annotator-store/issues{/number}","pulls_url":"https://api.github.com/repos/openannotation/annotator-store/pulls{/number}","milestones_url":"https://api.github.com/repos/openannotation/annotator-store/milestones{/number}","notifications_url":"https://api.github.com/repos/openannotation/annotator-store/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openannotation/annotator-store/labels{/name}","releases_url":"https://api.github.com/repos/openannotation/annotator-store/releases{/id}","created_at":"2011-02-22T11:30:09Z","updated_at":"2015-02-21T08:05:14Z","pushed_at":"2015-02-25T11:12:36Z","git_url":"git://github.com/openannotation/annotator-store.git","ssh_url":"git@github.com:openannotation/annotator-store.git","clone_url":"https://github.com/openannotation/annotator-store.git","svn_url":"https://github.com/openannotation/annotator-store","homepage":"http://annotateit.org/","size":1523,"stargazers_count":97,"watchers_count":97,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":7,"forks":40,"open_issues":7,"watchers":97,"default_branch":"master"}},"base":{"label":"openannotation:master","ref":"master","sha":"0f03b75b4add1ba953c922ce8d8a19c5157df511","user":{"login":"openannotation","id":3476110,"avatar_url":"https://avatars.githubusercontent.com/u/3476110?v=3","gravatar_id":"","url":"https://api.github.com/users/openannotation","html_url":"https://github.com/openannotation","followers_url":"https://api.github.com/users/openannotation/followers","following_url":"https://api.github.com/users/openannotation/following{/other_user}","gists_url":"https://api.github.com/users/openannotation/gists{/gist_id}","starred_url":"https://api.github.com/users/openannotation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openannotation/subscriptions","organizations_url":"https://api.github.com/users/openannotation/orgs","repos_url":"https://api.github.com/users/openannotation/repos","events_url":"https://api.github.com/users/openannotation/events{/privacy}","received_events_url":"https://api.github.com/users/openannotation/received_events","type":"Organization","site_admin":false},"repo":{"id":1397272,"name":"annotator-store","full_name":"openannotation/annotator-store","owner":{"login":"openannotation","id":3476110,"avatar_url":"https://avatars.githubusercontent.com/u/3476110?v=3","gravatar_id":"","url":"https://api.github.com/users/openannotation","html_url":"https://github.com/openannotation","followers_url":"https://api.github.com/users/openannotation/followers","following_url":"https://api.github.com/users/openannotation/following{/other_user}","gists_url":"https://api.github.com/users/openannotation/gists{/gist_id}","starred_url":"https://api.github.com/users/openannotation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openannotation/subscriptions","organizations_url":"https://api.github.com/users/openannotation/orgs","repos_url":"https://api.github.com/users/openannotation/repos","events_url":"https://api.github.com/users/openannotation/events{/privacy}","received_events_url":"https://api.github.com/users/openannotation/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openannotation/annotator-store","description":"A backend store for the Annotator","fork":false,"url":"https://api.github.com/repos/openannotation/annotator-store","forks_url":"https://api.github.com/repos/openannotation/annotator-store/forks","keys_url":"https://api.github.com/repos/openannotation/annotator-store/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openannotation/annotator-store/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openannotation/annotator-store/teams","hooks_url":"https://api.github.com/repos/openannotation/annotator-store/hooks","issue_events_url":"https://api.github.com/repos/openannotation/annotator-store/issues/events{/number}","events_url":"https://api.github.com/repos/openannotation/annotator-store/events","assignees_url":"https://api.github.com/repos/openannotation/annotator-store/assignees{/user}","branches_url":"https://api.github.com/repos/openannotation/annotator-store/branches{/branch}","tags_url":"https://api.github.com/repos/openannotation/annotator-store/tags","blobs_url":"https://api.github.com/repos/openannotation/annotator-store/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openannotation/annotator-store/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openannotation/annotator-store/git/refs{/sha}","trees_url":"https://api.github.com/repos/openannotation/annotator-store/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openannotation/annotator-store/statuses/{sha}","languages_url":"https://api.github.com/repos/openannotation/annotator-store/languages","stargazers_url":"https://api.github.com/repos/openannotation/annotator-store/stargazers","contributors_url":"https://api.github.com/repos/openannotation/annotator-store/contributors","subscribers_url":"https://api.github.com/repos/openannotation/annotator-store/subscribers","subscription_url":"https://api.github.com/repos/openannotation/annotator-store/subscription","commits_url":"https://api.github.com/repos/openannotation/annotator-store/commits{/sha}","git_commits_url":"https://api.github.com/repos/openannotation/annotator-store/git/commits{/sha}","comments_url":"https://api.github.com/repos/openannotation/annotator-store/comments{/number}","issue_comment_url":"https://api.github.com/repos/openannotation/annotator-store/issues/comments{/number}","contents_url":"https://api.github.com/repos/openannotation/annotator-store/contents/{+path}","compare_url":"https://api.github.com/repos/openannotation/annotator-store/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openannotation/annotator-store/merges","archive_url":"https://api.github.com/repos/openannotation/annotator-store/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openannotation/annotator-store/downloads","issues_url":"https://api.github.com/repos/openannotation/annotator-store/issues{/number}","pulls_url":"https://api.github.com/repos/openannotation/annotator-store/pulls{/number}","milestones_url":"https://api.github.com/repos/openannotation/annotator-store/milestones{/number}","notifications_url":"https://api.github.com/repos/openannotation/annotator-store/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openannotation/annotator-store/labels{/name}","releases_url":"https://api.github.com/repos/openannotation/annotator-store/releases{/id}","created_at":"2011-02-22T11:30:09Z","updated_at":"2015-02-21T08:05:14Z","pushed_at":"2015-02-25T11:12:36Z","git_url":"git://github.com/openannotation/annotator-store.git","ssh_url":"git@github.com:openannotation/annotator-store.git","clone_url":"https://github.com/openannotation/annotator-store.git","svn_url":"https://github.com/openannotation/annotator-store","homepage":"http://annotateit.org/","size":1523,"stargazers_count":97,"watchers_count":97,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":7,"forks":40,"open_issues":7,"watchers":97,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openannotation/annotator-store/pulls/118"},"html":{"href":"https://github.com/openannotation/annotator-store/pull/118"},"issue":{"href":"https://api.github.com/repos/openannotation/annotator-store/issues/118"},"comments":{"href":"https://api.github.com/repos/openannotation/annotator-store/issues/118/comments"},"review_comments":{"href":"https://api.github.com/repos/openannotation/annotator-store/pulls/118/comments"},"review_comment":{"href":"https://api.github.com/repos/openannotation/annotator-store/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openannotation/annotator-store/pulls/118/commits"},"statuses":{"href":"https://api.github.com/repos/openannotation/annotator-store/statuses/0182a1615a1cb6f0a4df9b4d7c00a81199fa072f"}}}}