summaryrefslogtreecommitdiffstats
path: root/fatcat_scholar
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-08-06 23:08:43 -0700
committerBryan Newbold <bnewbold@archive.org>2020-08-06 23:08:43 -0700
commit4eb2fc1dc2e6c358f79bf58f080afa6511b2c8f0 (patch)
tree2947adac729236a3d6a45f34bf11cf9c87d9480b /fatcat_scholar
parent45e263f32a9dd05a6bc3932fd525712733b69a9d (diff)
downloadfatcat-scholar-4eb2fc1dc2e6c358f79bf58f080afa6511b2c8f0.tar.gz
fatcat-scholar-4eb2fc1dc2e6c358f79bf58f080afa6511b2c8f0.zip
re-use ES sync API client
Diffstat (limited to 'fatcat_scholar')
-rw-r--r--fatcat_scholar/search.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/fatcat_scholar/search.py b/fatcat_scholar/search.py
index 891abff..c362ea6 100644
--- a/fatcat_scholar/search.py
+++ b/fatcat_scholar/search.py
@@ -87,13 +87,14 @@ class FulltextHits(BaseModel):
results: List[Any]
+# global sync client connection
+es_client = elasticsearch.Elasticsearch(settings.ELASTICSEARCH_BACKEND, timeout=25.0)
+
+
def do_fulltext_search(
query: FulltextQuery, deep_page_limit: int = 2000
) -> FulltextHits:
- es_client = elasticsearch.Elasticsearch(
- settings.ELASTICSEARCH_BACKEND, timeout=25.0
- )
search = Search(using=es_client, index=settings.ELASTICSEARCH_FULLTEXT_INDEX)
# Convert raw DOIs to DOI queries