Skip to content

Commit

Permalink
sort matched documents by similarity after merge with mongodb values (#…
Browse files Browse the repository at this point in the history
…106)

* sort matched documents by similarity after merge with mongodb values
  • Loading branch information
jerpint authored Jun 9, 2023
1 parent fc97df5 commit 3d1bd0e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions buster/retriever/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,7 @@ def get_topk_documents(self, query: str, source: str, top_k: int) -> pd.DataFram
matched_documents["similarity"] = matched_documents["_id"].apply(lambda x: matching_scores[str(x)])
matched_documents["embedding"] = matched_documents["_id"].apply(lambda x: matching_embeddings[str(x)])

# sort by similarity
matched_documents = matched_documents.sort_values(by="similarity", ascending=False, ignore_index=True)

return matched_documents

0 comments on commit 3d1bd0e

Please sign in to comment.