Skip to content

Commit

Permalink
Limit the search results to 10000 records & corresponding # of pages
Browse files Browse the repository at this point in the history
  • Loading branch information
njkim committed Jul 10, 2019
1 parent a5076f5 commit 421c518
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion arches/app/search/components/paging_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions arches/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 421c518

Please sign in to comment.