aboutsummaryrefslogtreecommitdiffstats
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
parent4f42c82be2b1d9271307ac07fe6256cce3f4c5ea (diff)
downloadfatcat-scholar-5ae386783b81f4e2019f1d9a0d4f534c22c01a89.tar.gz
fatcat-scholar-5ae386783b81f4e2019f1d9a0d4f534c22c01a89.zip
ES: add 'preference' query param; default to '_local' in prod
-rw-r--r--fatcat_scholar/search.py3
-rw-r--r--settings.toml2
2 files changed, 5 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()
diff --git a/settings.toml b/settings.toml
index 76488b0..07ba1bd 100644
--- a/settings.toml
+++ b/settings.toml
@@ -5,6 +5,7 @@ SCHOLAR_ISSUEDB_PATH = "data/issue_db.sqlite"
I18N_LANG_DEFAULT = "en"
ELASTICSEARCH_QUERY_BASE = "http://localhost:9200"
ELASTICSEARCH_QUERY_FULLTEXT_INDEX = "scholar_fulltext"
+ELASTICSEARCH_QUERY_PREFERENCE = ""
ELASTICSEARCH_WRITE_BASE = "http://localhost:9200"
ELASTICSEARCH_WRITE_FULLTEXT_INDEX = "scholar_fulltext_v01"
ELASTICSEARCH_PUBLIC_URL = "http://localhost:9292"
@@ -65,6 +66,7 @@ SCHOLAR_ENV = "prod"
ONION_DOMAIN = "scholar.archivev3qli37bju4rlh27glh24lljyezwxf4pokmrdbpefjlcrp5id.onion"
ELASTICSEARCH_QUERY_BASE = "http://localhost:9292"
ELASTICSEARCH_QUERY_FULLTEXT_INDEX = "scholar_fulltext"
+ELASTICSEARCH_QUERY_PREFERENCE = "_local"
ELASTICSEARCH_WRITE_BASE = "http://localhost:9200"
ELASTICSEARCH_WRITE_FULLTEXT_INDEX = "scholar_fulltext_v01_20210128"
ELASTICSEARCH_PUBLIC_URL = "https://search.fatcat.wiki"