From 3516e7ee06ae9776355239c254c740d77d263c91 Mon Sep 17 00:00:00 2001 From: Justin Barrett Date: Thu, 11 Sep 2025 10:12:22 -0400 Subject: [PATCH] Adding single search --- rorapi/common/matching_single_search.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rorapi/common/matching_single_search.py b/rorapi/common/matching_single_search.py index 3ba5a1f..991c67d 100644 --- a/rorapi/common/matching_single_search.py +++ b/rorapi/common/matching_single_search.py @@ -245,7 +245,12 @@ def match_by_query(text, query, countries): chosen_candidate = None chosen_true = None results = query.execute() - candidates = results.hits.hits + except Exception as e: + return f"query error: {e}", None + try: + candidates = results.hits.hits + except Exception as e: + return f"candidates error: {e}\n{results}", None if candidates: candidates = [c for c in candidates if c["_source"]["status"] == "active"] scored_candidates = [score(text, c) for c in candidates]