Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix id for documents returned by the TfidfRetriever #232

Merged
merged 3 commits into from
Jul 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion haystack/retriever/sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def retrieve(self, query: str, filters: dict = None, top_k: int = 10, index: str
for para, meta in zip(paragraphs, meta_data):
documents.append(
Document(
id=meta["paragraph_id"],
id=meta["document_id"],
text=para,
meta=meta.get("meta", {})
))
Expand Down
1 change: 0 additions & 1 deletion test/test_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def test_finder_get_answers(reader, document_store_with_docs):
assert prediction["answers"][0]["probability"] >= 0
assert prediction["answers"][0]["meta"]["meta_field"] == "test1"
assert prediction["answers"][0]["context"] == "My name is Carla and I live in Berlin"
assert prediction["answers"][0]["document_id"] == "0"

assert len(prediction["answers"]) == 3

Expand Down
2 changes: 1 addition & 1 deletion test/test_tfidf_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_tfidf_retriever():
retriever.fit()
assert retriever.retrieve("godzilla", top_k=1) == [
Document(
id='0',
id='26f84672c6d7aaeb8e2cd53e9c62d62d',
text='godzilla says hello',
external_source_id=None,
question=None,
Expand Down