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

Add options for handling duplicate documents (skip, fail, overwrite) #1088

Merged
merged 10 commits into from
May 25, 2021
Merged

Add options for handling duplicate documents (skip, fail, overwrite) #1088

merged 10 commits into from
May 25, 2021

Conversation

akkefa
Copy link
Contributor

@akkefa akkefa commented May 23, 2021

Proposed changes:

Status (please check what you already did):

  • First draft (up for discussions & feedback)
  • Final code
  • Added tests
  • Updated documentation

@akkefa
Copy link
Contributor Author

akkefa commented May 23, 2021

@tholor Please review this pull request.

Copy link
Member

@tholor tholor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice progress... I think we're almost there :)
Left a few minor comments.

One bigger thing that I was wondering about: Speed of handle_duplicate_documents. I don't believe a single get_documents_by_id() is that expensive, but we need to make sure that it doesn't become a bottleneck for indexing. We can check this in our next benchmarking and iterate on it in case it's really an issue.

haystack/document_store/base.py Show resolved Hide resolved
haystack/document_store/base.py Outdated Show resolved Hide resolved
haystack/document_store/faiss.py Outdated Show resolved Hide resolved
test/test_faiss_and_milvus.py Outdated Show resolved Hide resolved
haystack/document_store/base.py Outdated Show resolved Hide resolved
:param documents: A list of Haystack Document objects.
:param duplicate_documents: Handle duplicates document based on parameter options.
Parameter options : ( 'skip','overwrite','fail')
skip (default option): Ignore the duplicates documents
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we want to make skip or overwrite the default option here. Any thoughts @lalitpagaria @oryx1729?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my view 'overwrite' will be good. User will get warning along with without any changes his latest/updated docs can be written to doc store.
In skip options, he can't move forward until he delete old documents.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume from the above comment, overwrite will be the default option.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think overwrite could be a good default value. I assume it'd overwrite the meta fields if they're different from the original?

@akkefa
Copy link
Contributor Author

akkefa commented May 25, 2021

Nice progress... I think we're almost there :)
Left a few minor comments.

One bigger thing that I was wondering about: Speed of handle_duplicate_documents. I don't believe a single get_documents_by_id() is that expensive, but we need to make sure that it doesn't become a bottleneck for indexing. We can check this in our next benchmarking and iterate on it in case it's really an issue.

In the haystack, there are still improvements that can be made for speed optimization and architecture improvements. Once the duplicate functionality criteria is approved then we will look into optimization.

@akkefa akkefa requested a review from tholor May 25, 2021 10:08
Copy link
Member

@tholor tholor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. I think this is ready to be merged. Thanks for addressing the comments so fast 👍

@tholor tholor changed the title Handle duplicate documents Add options for handling duplicate documents (skip, fail, overwrite) May 25, 2021
Copy link
Contributor

@lalitpagaria lalitpagaria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tholor tholor merged commit b76ed4c into deepset-ai:master May 25, 2021
@akkefa akkefa deleted the handle_duplicate_documents branch May 25, 2021 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve handling of duplicate documents during write_documents()
4 participants