summaryrefslogtreecommitdiffstats
path: root/fatcat_scholar/search.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-08-03 18:35:42 -0700
committerBryan Newbold <bnewbold@archive.org>2021-08-03 18:35:42 -0700
commit5ae386783b81f4e2019f1d9a0d4f534c22c01a89 (patch)
tree8842a4fb690f496fecc67e938723ef6164cb56b4 /fatcat_scholar/search.py
parent4f42c82be2b1d9271307ac07fe6256cce3f4c5ea (diff)
downloadfatcat-scholar-5ae386783b81f4e2019f1d9a0d4f534c22c01a89.tar.gz
fatcat-scholar-5ae386783b81f4e2019f1d9a0d4f534c22c01a89.zip
ES: add 'preference' query param; default to '_local' in prod
Diffstat (limited to 'fatcat_scholar/search.py')
-rw-r--r--fatcat_scholar/search.py3
1 files changed, 3 insertions, 0 deletions
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()