Skip to content

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

Merged
tholor merged 10 commits intodeepset-ai:masterfrom
akkefa:handle_duplicate_documents
May 25, 2021
Merged

Add options for handling duplicate documents (skip, fail, overwrite)#1088
tholor merged 10 commits intodeepset-ai:masterfrom
akkefa:handle_duplicate_documents

Conversation

@akkefa
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

akkefa commented May 23, 2021

@tholor Please review this pull request.

Comment thread haystack/document_store/base.py
Comment thread haystack/document_store/base.py
Comment thread haystack/document_store/base.py
Copy link
Copy Markdown
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.

Comment thread haystack/document_store/base.py
Comment thread haystack/document_store/base.py Outdated
Comment thread haystack/document_store/faiss.py Outdated
Comment thread test/test_faiss_and_milvus.py Outdated
Comment thread haystack/document_store/base.py Outdated
: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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@akkefa akkefa requested review from lalitpagaria and oryx1729 May 25, 2021 10:44
Copy link
Copy Markdown
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