diff --git a/arches/app/search/components/paging_filter.py b/arches/app/search/components/paging_filter.py index 216208be12..be258d4bac 100644 --- a/arches/app/search/components/paging_filter.py +++ b/arches/app/search/components/paging_filter.py @@ -17,25 +17,27 @@ class PagingFilter(BaseSearchFilter): def append_dsl(self, search_query_object, **kwargs): - export = self.request.GET.get("export", None) - mobile_download = self.request.GET.get("mobiledownload", None) + search_request_object = kwargs.get("search_request_object", self.request.GET) + export = search_request_object.get("export", None) + mobile_download = search_request_object.get("mobiledownload", None) page = ( 1 - if self.request.GET.get(self.componentname) == "" - else int(self.request.GET.get(self.componentname, 1)) + if search_request_object.get(self.componentname) == "" + else int(search_request_object.get(self.componentname, 1)) ) if export is not None: limit = settings.SEARCH_RESULT_LIMIT elif mobile_download is not None: - limit = self.request.GET["resourcecount"] + limit = search_request_object.get("resourcecount") else: limit = settings.SEARCH_ITEMS_PER_PAGE - limit = int(self.request.GET.get("limit", limit)) + limit = int(search_request_object.get("limit", limit)) search_query_object["query"].start = limit * int(page - 1) search_query_object["query"].limit = limit def post_search_hook(self, search_query_object, response_object, **kwargs): + search_request_object = kwargs.get("search_request_object", self.request.GET) total = ( response_object["results"]["hits"]["total"]["value"] if response_object["results"]["hits"]["total"]["value"] @@ -44,8 +46,8 @@ def post_search_hook(self, search_query_object, response_object, **kwargs): ) page = ( 1 - if self.request.GET.get(self.componentname) == "" - else int(self.request.GET.get(self.componentname, 1)) + if search_request_object.get(self.componentname) == "" + else int(search_request_object.get(self.componentname, 1)) ) paginator, pages = get_paginator( diff --git a/arches/app/search/components/sort_results.py b/arches/app/search/components/sort_results.py index 4682998560..7174b4648b 100644 --- a/arches/app/search/components/sort_results.py +++ b/arches/app/search/components/sort_results.py @@ -16,7 +16,7 @@ class SortResults(BaseSearchFilter): def append_dsl(self, search_query_object, **kwargs): - sort_param = self.request.GET.get(self.componentname, None) + sort_param = kwargs.get("querystring", None) if sort_param is not None and sort_param != "": search_query_object["query"].sort( diff --git a/arches/app/search/components/term_filter.py b/arches/app/search/components/term_filter.py index f100753766..23d8223ff5 100644 --- a/arches/app/search/components/term_filter.py +++ b/arches/app/search/components/term_filter.py @@ -34,7 +34,8 @@ def append_dsl(self, search_query_object, **kwargs): include_provisional = kwargs.get("include_provisional") search_query = Bool() querystring_params = kwargs.get("querystring", "[]") - language = self.request.GET.get("language", "*") + search_request_object = kwargs.get("search_request_object", self.request.GET) + language = search_request_object.get("language", "*") for term in JSONDeserializer().deserialize(querystring_params): if term["type"] == "term" or term["type"] == "string": string_filter = Bool()