{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/zamboni/pulls/comments/24513024","id":24513024,"diff_hunk":"@@ -170,43 +32,29 @@ class SearchView(CORSMixin, MarketplaceView, GenericAPIView):\n     authentication_classes = [RestSharedSecretAuthentication,\n                               RestOAuthAuthentication]\n     permission_classes = [AllowAny]\n+    filter_backends = [SearchQueryFilter, PublicSearchFormFilter,\n+                       ValidAppsFilter, DeviceTypeFilter, RegionFilter,\n+                       ProfileFilter, SortingFilter]\n     serializer_class = ESAppSerializer\n     form_class = ApiSearchForm\n     paginator_class = ESPaginator\n \n-    def search(self, request):\n-        \"\"\"\n-        Takes a request (expecting request.GET.q), and returns the serializer\n-        and search query.\n-        \"\"\"\n-        # Parse form.\n-        form = self.form_class(request.GET if request else None)\n-        if not form.is_valid():\n-            raise form_errors(form)\n-        form_data = form.cleaned_data\n-\n-        # Query and filter.\n-        no_filter = (\n-            request.GET.get('filtering', '1') == '0' and\n-            acl.action_allowed(request, 'Feed', 'Curate'))\n-        sq = WebappIndexer.get_app_filter(\n-            request, search_form_to_es_fields(form_data), no_filter=no_filter)\n-\n-        # Sort.\n-        sq = _sort_search(request, sq, form_data)\n-\n-        # Done.\n-        page = self.paginate_queryset(sq)\n-        return self.get_pagination_serializer(page), form_data.get('q', '')\n-\n     def get(self, request):\n-        serializer, _ = self.search(request)\n+        queryset = self.filter_queryset(self.get_queryset())\n+        page = self.paginate_queryset(queryset)\n+        serializer = self.get_pagination_serializer(page)\n         return Response(serializer.data)\n \n+    def get_queryset(self):\n+        return WebappIndexer.search()\n+\n \n class FeaturedSearchView(SearchView):\n+\n     def get(self, request, *args, **kwargs):\n-        serializer, _ = self.search(request)\n+        queryset = self.filter_queryset(self.get_queryset())\n+        page = self.paginate_queryset(queryset)\n+        serializer = self.get_pagination_serializer(page)\n         data = self.add_featured_etc(request, serializer.data)\n         response = Response(data)","path":"mkt/search/views.py","position":227,"original_position":227,"commit_id":"daa762ce0321e284036df90a2772b57ba71b201a","original_commit_id":"daa762ce0321e284036df90a2772b57ba71b201a","user":{"login":"diox","id":187006,"avatar_url":"https://avatars.githubusercontent.com/u/187006?v=3","gravatar_id":"","url":"https://api.github.com/users/diox","html_url":"https://github.com/diox","followers_url":"https://api.github.com/users/diox/followers","following_url":"https://api.github.com/users/diox/following{/other_user}","gists_url":"https://api.github.com/users/diox/gists{/gist_id}","starred_url":"https://api.github.com/users/diox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diox/subscriptions","organizations_url":"https://api.github.com/users/diox/orgs","repos_url":"https://api.github.com/users/diox/repos","events_url":"https://api.github.com/users/diox/events{/privacy}","received_events_url":"https://api.github.com/users/diox/received_events","type":"User","site_admin":false},"body":"I think you could just call super() and add stuff to response.data","created_at":"2015-02-11T17:16:46Z","updated_at":"2015-02-11T17:16:46Z","html_url":"https://github.com/mozilla/zamboni/pull/2906#discussion_r24513024","pull_request_url":"https://api.github.com/repos/mozilla/zamboni/pulls/2906","_links":{"self":{"href":"https://api.github.com/repos/mozilla/zamboni/pulls/comments/24513024"},"html":{"href":"https://github.com/mozilla/zamboni/pull/2906#discussion_r24513024"},"pull_request":{"href":"https://api.github.com/repos/mozilla/zamboni/pulls/2906"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/zamboni/pulls/2906","id":29060034,"html_url":"https://github.com/mozilla/zamboni/pull/2906","diff_url":"https://github.com/mozilla/zamboni/pull/2906.diff","patch_url":"https://github.com/mozilla/zamboni/pull/2906.patch","issue_url":"https://api.github.com/repos/mozilla/zamboni/issues/2906","number":2906,"state":"open","locked":false,"title":"Replace custom search filtering with DRF filter classes (bug 1128783)","user":{"login":"robhudson","id":1106,"avatar_url":"https://avatars.githubusercontent.com/u/1106?v=3","gravatar_id":"","url":"https://api.github.com/users/robhudson","html_url":"https://github.com/robhudson","followers_url":"https://api.github.com/users/robhudson/followers","following_url":"https://api.github.com/users/robhudson/following{/other_user}","gists_url":"https://api.github.com/users/robhudson/gists{/gist_id}","starred_url":"https://api.github.com/users/robhudson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robhudson/subscriptions","organizations_url":"https://api.github.com/users/robhudson/orgs","repos_url":"https://api.github.com/users/robhudson/repos","events_url":"https://api.github.com/users/robhudson/events{/privacy}","received_events_url":"https://api.github.com/users/robhudson/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-02-11T00:47:29Z","updated_at":"2015-02-11T17:16:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6ef149d6f3037f65bfd425bc8e7015b21de8446f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/zamboni/pulls/2906/commits","review_comments_url":"https://api.github.com/repos/mozilla/zamboni/pulls/2906/comments","review_comment_url":"https://api.github.com/repos/mozilla/zamboni/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mozilla/zamboni/issues/2906/comments","statuses_url":"https://api.github.com/repos/mozilla/zamboni/statuses/daa762ce0321e284036df90a2772b57ba71b201a","head":{"label":"robhudson:1128783-search-filters","ref":"1128783-search-filters","sha":"daa762ce0321e284036df90a2772b57ba71b201a","user":{"login":"robhudson","id":1106,"avatar_url":"https://avatars.githubusercontent.com/u/1106?v=3","gravatar_id":"","url":"https://api.github.com/users/robhudson","html_url":"https://github.com/robhudson","followers_url":"https://api.github.com/users/robhudson/followers","following_url":"https://api.github.com/users/robhudson/following{/other_user}","gists_url":"https://api.github.com/users/robhudson/gists{/gist_id}","starred_url":"https://api.github.com/users/robhudson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robhudson/subscriptions","organizations_url":"https://api.github.com/users/robhudson/orgs","repos_url":"https://api.github.com/users/robhudson/repos","events_url":"https://api.github.com/users/robhudson/events{/privacy}","received_events_url":"https://api.github.com/users/robhudson/received_events","type":"User","site_admin":false},"repo":{"id":2393766,"name":"zamboni","full_name":"robhudson/zamboni","owner":{"login":"robhudson","id":1106,"avatar_url":"https://avatars.githubusercontent.com/u/1106?v=3","gravatar_id":"","url":"https://api.github.com/users/robhudson","html_url":"https://github.com/robhudson","followers_url":"https://api.github.com/users/robhudson/followers","following_url":"https://api.github.com/users/robhudson/following{/other_user}","gists_url":"https://api.github.com/users/robhudson/gists{/gist_id}","starred_url":"https://api.github.com/users/robhudson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robhudson/subscriptions","organizations_url":"https://api.github.com/users/robhudson/orgs","repos_url":"https://api.github.com/users/robhudson/repos","events_url":"https://api.github.com/users/robhudson/events{/privacy}","received_events_url":"https://api.github.com/users/robhudson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/robhudson/zamboni","description":"A clone of mozilla/zamboni.","fork":true,"url":"https://api.github.com/repos/robhudson/zamboni","forks_url":"https://api.github.com/repos/robhudson/zamboni/forks","keys_url":"https://api.github.com/repos/robhudson/zamboni/keys{/key_id}","collaborators_url":"https://api.github.com/repos/robhudson/zamboni/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/robhudson/zamboni/teams","hooks_url":"https://api.github.com/repos/robhudson/zamboni/hooks","issue_events_url":"https://api.github.com/repos/robhudson/zamboni/issues/events{/number}","events_url":"https://api.github.com/repos/robhudson/zamboni/events","assignees_url":"https://api.github.com/repos/robhudson/zamboni/assignees{/user}","branches_url":"https://api.github.com/repos/robhudson/zamboni/branches{/branch}","tags_url":"https://api.github.com/repos/robhudson/zamboni/tags","blobs_url":"https://api.github.com/repos/robhudson/zamboni/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/robhudson/zamboni/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/robhudson/zamboni/git/refs{/sha}","trees_url":"https://api.github.com/repos/robhudson/zamboni/git/trees{/sha}","statuses_url":"https://api.github.com/repos/robhudson/zamboni/statuses/{sha}","languages_url":"https://api.github.com/repos/robhudson/zamboni/languages","stargazers_url":"https://api.github.com/repos/robhudson/zamboni/stargazers","contributors_url":"https://api.github.com/repos/robhudson/zamboni/contributors","subscribers_url":"https://api.github.com/repos/robhudson/zamboni/subscribers","subscription_url":"https://api.github.com/repos/robhudson/zamboni/subscription","commits_url":"https://api.github.com/repos/robhudson/zamboni/commits{/sha}","git_commits_url":"https://api.github.com/repos/robhudson/zamboni/git/commits{/sha}","comments_url":"https://api.github.com/repos/robhudson/zamboni/comments{/number}","issue_comment_url":"https://api.github.com/repos/robhudson/zamboni/issues/comments/{number}","contents_url":"https://api.github.com/repos/robhudson/zamboni/contents/{+path}","compare_url":"https://api.github.com/repos/robhudson/zamboni/compare/{base}...{head}","merges_url":"https://api.github.com/repos/robhudson/zamboni/merges","archive_url":"https://api.github.com/repos/robhudson/zamboni/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/robhudson/zamboni/downloads","issues_url":"https://api.github.com/repos/robhudson/zamboni/issues{/number}","pulls_url":"https://api.github.com/repos/robhudson/zamboni/pulls{/number}","milestones_url":"https://api.github.com/repos/robhudson/zamboni/milestones{/number}","notifications_url":"https://api.github.com/repos/robhudson/zamboni/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/robhudson/zamboni/labels{/name}","releases_url":"https://api.github.com/repos/robhudson/zamboni/releases{/id}","created_at":"2011-09-15T16:43:32Z","updated_at":"2014-06-25T00:45:02Z","pushed_at":"2015-02-11T00:47:06Z","git_url":"git://github.com/robhudson/zamboni.git","ssh_url":"git@github.com:robhudson/zamboni.git","clone_url":"https://github.com/robhudson/zamboni.git","svn_url":"https://github.com/robhudson/zamboni","homepage":"https://zamboni.readthedocs.org/en/latest/","size":320543,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":false,"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":"mozilla:master","ref":"master","sha":"ed470b6f5ce27c52ad3908bad057e9741678b0a6","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":347655,"name":"zamboni","full_name":"mozilla/zamboni","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/zamboni","description":"Backend for the Firefox Marketplace","fork":false,"url":"https://api.github.com/repos/mozilla/zamboni","forks_url":"https://api.github.com/repos/mozilla/zamboni/forks","keys_url":"https://api.github.com/repos/mozilla/zamboni/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/zamboni/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/zamboni/teams","hooks_url":"https://api.github.com/repos/mozilla/zamboni/hooks","issue_events_url":"https://api.github.com/repos/mozilla/zamboni/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/zamboni/events","assignees_url":"https://api.github.com/repos/mozilla/zamboni/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/zamboni/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/zamboni/tags","blobs_url":"https://api.github.com/repos/mozilla/zamboni/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/zamboni/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/zamboni/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/zamboni/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/zamboni/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/zamboni/languages","stargazers_url":"https://api.github.com/repos/mozilla/zamboni/stargazers","contributors_url":"https://api.github.com/repos/mozilla/zamboni/contributors","subscribers_url":"https://api.github.com/repos/mozilla/zamboni/subscribers","subscription_url":"https://api.github.com/repos/mozilla/zamboni/subscription","commits_url":"https://api.github.com/repos/mozilla/zamboni/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/zamboni/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/zamboni/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/zamboni/issues/comments/{number}","contents_url":"https://api.github.com/repos/mozilla/zamboni/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/zamboni/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/zamboni/merges","archive_url":"https://api.github.com/repos/mozilla/zamboni/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/zamboni/downloads","issues_url":"https://api.github.com/repos/mozilla/zamboni/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/zamboni/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/zamboni/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/zamboni/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/zamboni/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/zamboni/releases{/id}","created_at":"2009-10-23T19:35:34Z","updated_at":"2015-02-11T17:09:18Z","pushed_at":"2015-02-11T17:09:17Z","git_url":"git://github.com/mozilla/zamboni.git","ssh_url":"git@github.com:mozilla/zamboni.git","clone_url":"https://github.com/mozilla/zamboni.git","svn_url":"https://github.com/mozilla/zamboni","homepage":"http://marketplace.readthedocs.org/en/latest/topics/backend.html","size":381740,"stargazers_count":451,"watchers_count":451,"language":"Python","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":239,"mirror_url":null,"open_issues_count":12,"forks":239,"open_issues":12,"watchers":451,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/zamboni/pulls/2906"},"html":{"href":"https://github.com/mozilla/zamboni/pull/2906"},"issue":{"href":"https://api.github.com/repos/mozilla/zamboni/issues/2906"},"comments":{"href":"https://api.github.com/repos/mozilla/zamboni/issues/2906/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/zamboni/pulls/2906/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/zamboni/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mozilla/zamboni/pulls/2906/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/zamboni/statuses/daa762ce0321e284036df90a2772b57ba71b201a"}}}}