From dc3f399f91df3bd9ed1d64a027770e4bc69ab063 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Sun, 16 Apr 2023 20:22:51 +0700 Subject: [PATCH] Fix to get score associated with SearchResponse in result as string --- src/khoj/search_type/text_search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/khoj/search_type/text_search.py b/src/khoj/search_type/text_search.py index 69093942..8cfd35a2 100644 --- a/src/khoj/search_type/text_search.py +++ b/src/khoj/search_type/text_search.py @@ -154,7 +154,7 @@ def collate_results(hits, entries: List[Entry], count=5) -> List[SearchResponse] SearchResponse.parse_obj( { "entry": entries[hit["corpus_id"]].raw, - "score": f"{hit.get('cross-score', 'score')}:.3f", + "score": f"{hit.get('cross-score') or hit.get('score')}", "additional": {"file": entries[hit["corpus_id"]].file, "compiled": entries[hit["corpus_id"]].compiled}, } )