Skip to content

Conversation

@bidoubiwa
Copy link
Contributor

Add fields parameter in the get_document route.

Breaking

  • on the method Index.get_document you are now able to add a field on the fields you want to be returned in the documents.
    #[derive(Serialize, Debug)]
    struct Movie {
       name: String,
       description: String,
       age: Option<usize>
    }
    
   movies.add_or_replace(&[Movie{name:String::from("Interstellar"), description:String::from("Interstellar chronicles the adventures."), age: Some(1)}], Some("name")).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();

    #[derive(Deserialize, Debug)]
    # #[derive(PartialEq)]
    struct ReturnedMovie {
       name: String,
       description: String
    }
    let interstellar = movies.get_document::<ReturnedMovie>("Interstellar", Some(["name", "description"].to_vec())).await.unwrap();
    assert_eq!(interstellar, ReturnedMovie {
      name: String::from("Interstellar"),
      description: String::from("Interstellar chronicles the adventures."),
    });

@bidoubiwa bidoubiwa added the breaking-change The related changes are breaking for the users label Aug 29, 2022
@bidoubiwa bidoubiwa requested review from alallema and irevoire August 29, 2022 09:48
@bidoubiwa bidoubiwa requested a review from irevoire August 29, 2022 14:29
Base automatically changed from update_documents_for_v0.28.0 to bump-meilisearch-v0.28.0 August 29, 2022 14:38
@bidoubiwa bidoubiwa merged commit 70f5424 into bump-meilisearch-v0.28.0 Aug 29, 2022
@bidoubiwa bidoubiwa deleted the update_get_document_for_v0.28.0 branch August 29, 2022 14:41
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants