aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-04-12 14:49:58 -0700
committerBryan Newbold <bnewbold@archive.org>2021-04-12 14:49:58 -0700
commit06e1b31fa2262fd5367d13f99d1edef0b896a9f1 (patch)
tree1aec1b9001aa8d4130e6f7e1d9e2e9d02a1251bd
parentededee81530ae2d7179e34c9a8ebefb2689fea28 (diff)
downloadfatcat-scholar-06e1b31fa2262fd5367d13f99d1edef0b896a9f1.tar.gz
fatcat-scholar-06e1b31fa2262fd5367d13f99d1edef0b896a9f1.zip
search: more aggressively skip fuzzy match exceptions
-rw-r--r--fatcat_scholar/search.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/fatcat_scholar/search.py b/fatcat_scholar/search.py
index c52cae3..5571909 100644
--- a/fatcat_scholar/search.py
+++ b/fatcat_scholar/search.py
@@ -8,6 +8,7 @@ import datetime
from gettext import gettext
from typing import List, Optional, Any
+import sentry_sdk
import elasticsearch
from elasticsearch_dsl import Search, Q
from elasticsearch_dsl.response import Response
@@ -236,6 +237,7 @@ def process_query(query: FulltextQuery) -> FulltextHits:
)
fatcat_es_client = elasticsearch.Elasticsearch("https://search.fatcat.wiki")
key: Optional[str] = None
+ # "best effort" fuzzy match lookup (but aggressively skip on any exception)
try:
key = try_fuzzy_match(
query.q,
@@ -243,13 +245,11 @@ def process_query(query: FulltextQuery) -> FulltextHits:
es_client=fatcat_es_client,
fatcat_api_client=api_client,
)
- except elasticsearch.exceptions.RequestError as e:
- logging.warn(f"citation fuzzy failure: {e}")
- pass
except Exception as e:
- # TODO: sentry log?
logging.warn(f"citation fuzzy failure: {e}")
- raise e
+ sentry_sdk.set_level("warning")
+ sentry_sdk.capture_exception(e)
+ pass
if key:
result = do_lookup_query(f"key:{key}")
if result: