Skip to content

Commit

Permalink
fix(api): Fixed score merge and improved related test
Browse files Browse the repository at this point in the history
  • Loading branch information
albertisfu committed Nov 22, 2024
1 parent a6b05f1 commit d12e30b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cl/lib/elasticsearch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3355,5 +3355,5 @@ def set_child_docs_and_score(
merge_highlights_into_result(meta_hl, result)

# Optionally merges the BM25 score for display in the API.
if merge_score and isinstance(result, Response):
if merge_score and isinstance(result, AttrDict):
result["bm25_score"] = result.meta.score
5 changes: 5 additions & 0 deletions cl/tests/cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ async def _compare_field(
set(meta_expected_value.keys()),
f"The keys in field '{meta_field}' do not match.",
)
for score_value in meta_value.values():
self.assertIsNotNone(
score_value, f"The score value can't be None."
)

else:
self.assertEqual(
meta_value,
Expand Down

0 comments on commit d12e30b

Please sign in to comment.