From 421c518b2b7a698b14a5a4d979a7ddb951221787 Mon Sep 17 00:00:00 2001 From: njkim Date: Wed, 10 Jul 2019 13:30:10 -0700 Subject: [PATCH] Limit the search results to 10000 records & corresponding # of pages --- arches/app/search/components/paging_filter.py | 2 +- arches/settings.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arches/app/search/components/paging_filter.py b/arches/app/search/components/paging_filter.py index 677d32835c9..6433eaa7fda 100644 --- a/arches/app/search/components/paging_filter.py +++ b/arches/app/search/components/paging_filter.py @@ -34,7 +34,7 @@ def append_dsl(self, search_results_object, permitted_nodegroups, include_provis search_results_object['query'].limit = limit def post_search_hook(self, search_results_object, results, permitted_nodegroups): - total = results['hits']['total'] + total = results['hits']['total'] if results['hits']['total'] <= settings.SEARCH_RESULT_LIMIT else settings.SEARCH_RESULT_LIMIT page = 1 if self.request.GET.get(details['componentname']) == '' else int(self.request.GET.get(details['componentname'], 1)) paginator, pages = get_paginator(self.request, results, total, page, settings.SEARCH_ITEMS_PER_PAGE) diff --git a/arches/settings.py b/arches/settings.py index be7d9fb2d62..2d6399fd80e 100644 --- a/arches/settings.py +++ b/arches/settings.py @@ -467,6 +467,7 @@ SEARCH_DROPDOWN_LENGTH = 100 SEARCH_TERM_SENSITIVITY = 3 # a lower number will give more "Fuzzy" matches, recomend between 0-4, see "prefix_length" at https://www.elastic.co/guide/en/elasticsearch/reference/6.7/query-dsl-fuzzy-query.html#_parameters_7 WORDS_PER_SEARCH_TERM = 10 # set to None for unlimited number of words allowed for search terms +SEARCH_RESULT_LIMIT = 10000 # should be less than or equal to elasticsearch configuration, index.max_result_window (default = 10,000) ETL_USERNAME = 'ETL' # override this setting in your packages settings.py file