mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-11-13 16:43:44 +00:00
Fix id for documents returned by the TfidfRetriever (#232)
This commit is contained in:
parent
4e10a1520d
commit
912e98cd40
@ -186,7 +186,7 @@ class TfidfRetriever(BaseRetriever):
|
|||||||
for para, meta in zip(paragraphs, meta_data):
|
for para, meta in zip(paragraphs, meta_data):
|
||||||
documents.append(
|
documents.append(
|
||||||
Document(
|
Document(
|
||||||
id=meta["paragraph_id"],
|
id=meta["document_id"],
|
||||||
text=para,
|
text=para,
|
||||||
meta=meta.get("meta", {})
|
meta=meta.get("meta", {})
|
||||||
))
|
))
|
||||||
|
|||||||
@ -16,7 +16,6 @@ def test_finder_get_answers(reader, document_store_with_docs):
|
|||||||
assert prediction["answers"][0]["probability"] >= 0
|
assert prediction["answers"][0]["probability"] >= 0
|
||||||
assert prediction["answers"][0]["meta"]["meta_field"] == "test1"
|
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]["context"] == "My name is Carla and I live in Berlin"
|
||||||
assert prediction["answers"][0]["document_id"] == "0"
|
|
||||||
|
|
||||||
assert len(prediction["answers"]) == 3
|
assert len(prediction["answers"]) == 3
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ def test_tfidf_retriever():
|
|||||||
retriever.fit()
|
retriever.fit()
|
||||||
assert retriever.retrieve("godzilla", top_k=1) == [
|
assert retriever.retrieve("godzilla", top_k=1) == [
|
||||||
Document(
|
Document(
|
||||||
id='0',
|
id='26f84672c6d7aaeb8e2cd53e9c62d62d',
|
||||||
text='godzilla says hello',
|
text='godzilla says hello',
|
||||||
external_source_id=None,
|
external_source_id=None,
|
||||||
question=None,
|
question=None,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user