aboutsummaryrefslogtreecommitdiffstats
path: root/fuzzycat/utils.py
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-12-17 10:07:15 +0100
committerMartin Czygan <martin.czygan@gmail.com>2021-12-21 20:56:56 +0100
commitde9f1155ea57c812171abd5517ab39f4fe135cb3 (patch)
tree2b2071642259c46ede5b56d15cbce15187226362 /fuzzycat/utils.py
parent4720fb51584fae1edc2a79dd94c24b4ddac92acb (diff)
downloadfuzzycat-master.tar.gz
fuzzycat-master.zip
apply first round of feedback on matchingHEADmaster
Diffstat (limited to 'fuzzycat/utils.py')
-rw-r--r--fuzzycat/utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/fuzzycat/utils.py b/fuzzycat/utils.py
index 24e103a..dadfa5c 100644
--- a/fuzzycat/utils.py
+++ b/fuzzycat/utils.py
@@ -30,6 +30,13 @@ def es_compat_hits_total(resp):
"""
try:
return resp["hits"]["total"]["value"] # ES7
+ except KeyError:
+ # with track_total_hits set to False, we observed missing "total" keys,
+ # es returns: {'_shards': {'failed': 0, 'skipped': 0, 'successful': 6,
+ # 'total': 6}, 'hits': {'hits': [{'_id': 'yvqtz2zvkzcbpj4jxrp7b...ons':
+ # [], 'any_abstract': False, 'ark_id': None, ...}, ...}],
+ # 'max_score': 108.32384}, 'timed_out': False, 'took': 921}
+ return len(resp["hits"]["hits"])
except TypeError:
return resp["hits"]["total"] # ES6