Skip to content

Commit

Permalink
Update document_stores/elasticsearch/src/elasticsearch_haystack/docum…
Browse files Browse the repository at this point in the history
…ent_store.py

Co-authored-by: Silvano Cerza <[email protected]>
  • Loading branch information
anakin87 and silvanocerza authored Nov 20, 2023
1 parent b3e6cb7 commit 1c310cb
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,11 @@ def _bm25_retrieval(

documents = self._search_documents(**body)

if not scale_score:
return documents
if scale_score:
for doc in documents:
doc.score = float(1 / (1 + np.exp(-np.asarray(doc.score / BM25_SCALING_FACTOR))))

documents_w_scaled_scores = []
for doc in documents:
doc.score = float(1 / (1 + np.exp(-np.asarray(doc.score / BM25_SCALING_FACTOR))))
documents_w_scaled_scores.append(doc)

return documents_w_scaled_scores
return documents

def _embedding_retrieval(
self,
Expand Down

0 comments on commit 1c310cb

Please sign in to comment.