From 5ae386783b81f4e2019f1d9a0d4f534c22c01a89 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 3 Aug 2021 18:35:42 -0700 Subject: ES: add 'preference' query param; default to '_local' in prod --- fatcat_scholar/search.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'fatcat_scholar') diff --git a/fatcat_scholar/search.py b/fatcat_scholar/search.py index 121cb69..dccaf07 100644 --- a/fatcat_scholar/search.py +++ b/fatcat_scholar/search.py @@ -377,6 +377,9 @@ def do_fulltext_search( search = search.params(track_total_hits=True) search = search[offset : (offset + limit)] + if settings.ELASTICSEARCH_QUERY_PREFERENCE: + search = search.params(preference=settings.ELASTICSEARCH_QUERY_PREFERENCE) + query_start = datetime.datetime.now() try: resp = search.execute() -- cgit v1.2.3