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

Fixed performance bug. Using a list where a set is needed. #2125

Merged
merged 1 commit into from
Feb 3, 2022
Merged
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
6 changes: 3 additions & 3 deletions haystack/document_stores/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Generator, Optional, Dict, List, Union
from typing import Generator, Optional, Dict, List, Set, Union

import logging
import collections
Expand Down Expand Up @@ -466,7 +466,7 @@ def _drop_duplicate_documents(self, documents: List[Document]) -> List[Document]
:param documents: A list of Haystack Document objects.
:return: A list of Haystack Document objects.
"""
_hash_ids: list = []
_hash_ids: Set = set([])
_documents: List[Document] = []

for document in documents:
Expand All @@ -476,7 +476,7 @@ def _drop_duplicate_documents(self, documents: List[Document]) -> List[Document]
)
continue
_documents.append(document)
_hash_ids.append(document.id)
_hash_ids.add(document.id)

return _documents

Expand Down