Skip to content

Conversation

honne23
Copy link

@honne23 honne23 commented Apr 14, 2022

Pull Request

What does this PR do?

Fixes #255

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue?
  • 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!

@bidoubiwa
Copy link
Contributor

Thanks 🙏

Could you update the .code-samples.meilisearch.yaml file ?

@irevoire
Copy link
Contributor

Hey, thanks for your contribution!
I'll review the PR tomorrow or on Monday but it look pretty good 🎉

@honne23
Copy link
Author

honne23 commented Apr 14, 2022

Thank you everyone, unfortunately my macbook literally just died (screen fried) the moment I pushed up this PR. I'll see how fast I can get a new one but it might delay any further updates from me :/

@honne23
Copy link
Author

honne23 commented Apr 15, 2022

@bidoubiwa @irevoire back with a new M1 mac and updated the code samples

honne23 and others added 9 commits April 17, 2022 16:58
remove unnecessary lifetime syntax

Co-authored-by: Tamo <[email protected]>
fix and update import syntax for documentation

Co-authored-by: Tamo <[email protected]>
remove unnecessary lifetime syntax from function signature

Co-authored-by: Tamo <[email protected]>
fix imports in documentation

Co-authored-by: Tamo <[email protected]>
fix imports in documentation

Co-authored-by: Tamo <[email protected]>
fix parameter value in documentation

Co-authored-by: Tamo <[email protected]>
fix imports in documentation

Co-authored-by: Tamo <[email protected]>
fix imports in documentation

Co-authored-by: Tamo <[email protected]>
fix spacing in documentation

Co-authored-by: Tamo <[email protected]>
@brunoocasali
Copy link
Member

brunoocasali commented Apr 18, 2022

@irevoire the changes are breaking somehow for the users?

@brunoocasali brunoocasali added the enhancement New feature or request label Apr 18, 2022
Copy link
Member

@brunoocasali brunoocasali left a comment

Choose a reason for hiding this comment

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

@honne23 thanks for your contribution! ❤️

But I need your help to fix the README :)

Check it out: https://github.com/meilisearch/meilisearch-rust/runs/6065376469?check_suite_focus=true

@irevoire
Copy link
Contributor

@brunoocasali yes it's breaking

@brunoocasali brunoocasali added the breaking-change The related changes are breaking for the users label Apr 18, 2022

/// Alias for [Index::add_or_replace].
pub async fn add_documents<T: Document>(
pub async fn add_documents<T: DeserializeOwned + Serialize + std::fmt::Debug>(

Choose a reason for hiding this comment

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

The DeserializeOwned is not necessary here. Remove it so that we can add docs like this:

  #[derive(Serialize, Debug)]
  struct Movie<'a> {
      name: &'a str,
      description: &'a str,
  }

Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @kvinwang, just so you have the whole context over this PR.
There was a little discussion on our slack community a few days ago where @honne23 explained to us why the Owned version was needed;
image

Choose a reason for hiding this comment

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

There was a little discussion on our slack community a few days ago where @honne23 explained to us why the Owned version was needed;

The issue here is not about Owned or not. The add_documents only need to serialize the data, So neither DeserializeOwned or Deserialize is needed here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yes you're right my bad!

/// ```
pub async fn get_document<T: 'static + Document>(&self, uid: T::UIDType) -> Result<T, Error> {
Ok(request::<(), T>(
pub async fn get_document<T: 'static + DeserializeOwned+ Serialize>(&self, uid: &str) -> Result<T, Error> {

Choose a reason for hiding this comment

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

We can remove the Serialize bound.

/// # });
/// ```
pub async fn get_documents<T: 'static + Document>(
pub async fn get_documents<T: 'static + DeserializeOwned + Serialize + std::fmt::Debug>(

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor

Choose a reason for hiding this comment

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

We can also remove the std::fmt::Debug here from what I see 👍

@honne23
Copy link
Author

honne23 commented Apr 19, 2022

working on this today, will push this through later

/// # });
/// ```
pub async fn add_or_replace<T: Document>(
pub async fn add_or_replace<T: DeserializeOwned + Serialize + std::fmt::Debug>(
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, if we can we should remove the Debug

@irevoire
Copy link
Contributor

Hey, @honne23, I would like to merge this PR soon. Do you think you'll be able to work on it today?
Or can I take your PR and implements the last few comments?

@irevoire
Copy link
Contributor

irevoire commented Apr 21, 2022

Closing in favor of #267

Thanks for your contribution 💝

@irevoire irevoire closed this Apr 21, 2022
@brunoocasali brunoocasali added the stale Pull request or issue that has recieve no activity for a long time. label Apr 22, 2022
bors bot added a commit that referenced this pull request Apr 22, 2022
267: fixed formatting with clippy and removed Document trait r=brunoocasali a=irevoire

# Pull Request
Since `@honne23` doesn't seem available currently, and we have #262, #263, and #264 waiting for this PR to be merged, I took back on it.

But thanks a lot, `@honne23;` you wrote most of the code, and I just applied the few left comments.
Thanks for contributing!

## What does this PR do?
Fixes #255 
Closes #261

<!-- Please link the issue you're trying to fix with this PR, if none then please create an issue first. -->

## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

Co-authored-by: Adrian Coutsoftides <[email protected]>
Co-authored-by: Bruno Casali <[email protected]>
bors bot added a commit that referenced this pull request Apr 22, 2022
267: fixed formatting with clippy and removed Document trait r=brunoocasali a=irevoire

# Pull Request
Since `@honne23` doesn't seem available currently, and we have #262, #263, and #264 waiting for this PR to be merged, I took back on it.

But thanks a lot, `@honne23;` you wrote most of the code, and I just applied the few left comments.
Thanks for contributing!

## What does this PR do?
Fixes #255 
Closes #261

<!-- Please link the issue you're trying to fix with this PR, if none then please create an issue first. -->

## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

Co-authored-by: Adrian Coutsoftides <[email protected]>
Co-authored-by: Bruno Casali <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change The related changes are breaking for the users enhancement New feature or request stale Pull request or issue that has recieve no activity for a long time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove Document trait asking for UIDType

5 participants