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

Improve documentation for Index.add_documents() methods #1057

Merged

Conversation

samuelbradshaw
Copy link
Contributor

Pull Request

Related issue

Fixes #1056

What does this PR do?

  • Improves the documentation for Index.add_documents_csv(), Index.add_documents_json(), Index.add_documents_ndjson(), and Index.add_documents_raw(). These methods require a byte string as input, not a regular string (this wasn't documented clearly).
  • Fixes incorrect documentation for Index.add_documents_raw(). Instead of a type variable, the method takes a content_type variable; and it's not optional (if it's left out, the server will give a 415 error).

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

meilisearch/index.py Show resolved Hide resolved
@sanders41
Copy link
Collaborator

I noticed that the post method also needs to accept bytes. We may as well do the same with post and patch. I'm on my phone right now, but can better point you to were to do that once I get to a computer.

@sanders41
Copy link
Collaborator

Alright I was able to check it out. In _httprequests.py we need to add bytes as an option to the body parameter in send_request, post, put, and patch. This along with adding content_type back should get things passing.

@sanders41 sanders41 added the bug Something isn't working label Jan 7, 2025
Copy link
Collaborator

@sanders41 sanders41 left a comment

Choose a reason for hiding this comment

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

Thanks for the report and the fix @samuelbradshaw!

@sanders41 sanders41 merged commit 372c082 into meilisearch:main Jan 7, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to add documents to an index as TSV or CSV
2 participants