Skip to content

Conversation

@bidoubiwa
Copy link
Contributor

@bidoubiwa bidoubiwa commented Aug 2, 2022

In preparation of the v0.28.0 compatibility update with Meilisearch, we added yaup to handle the future requirements in query parameter formating.

Currently it was done by hand, example:

pub async fn get_documents<T: DeserializeOwned + 'static>(
&self,
offset: Option<usize>,
limit: Option<usize>,
attributes_to_retrieve: Option<&str>,
) -> Result<Vec<T>, Error> {
let mut url = format!("{}/indexes/{}/documents?", self.client.host, self.uid);
if let Some(offset) = offset {
url.push_str("offset=");
url.push_str(offset.to_string().as_str());
url.push('&');
}
if let Some(limit) = limit {
url.push_str("limit=");
url.push_str(limit.to_string().as_str());
url.push('&');
}
if let Some(attributes_to_retrieve) = attributes_to_retrieve {
url.push_str("attributesToRetrieve=");
url.push_str(attributes_to_retrieve);
}
request::<(), Vec<T>>(&url, &self.client.api_key, Method::Get, 200).await
}

But, with the new version of Meilisearch a lot of query parameters are added in multiple routes.
To avoid having to do this tedious task over and over again we are using yaup that is maintained by Meilisearch and that formats query parameters in a meilisearch compatible way.

Test are failing because they are done against Meilisearch v0.28 and not Meilisearch v0.27. Prouf of successful tests:

Screenshot 2022-08-02 at 18 46 06

@bidoubiwa bidoubiwa requested a review from irevoire August 2, 2022 16:48
@bidoubiwa bidoubiwa added the enhancement New feature or request label Aug 2, 2022
@bidoubiwa bidoubiwa requested a review from brunoocasali August 2, 2022 16:48
@bidoubiwa bidoubiwa marked this pull request as ready for review August 2, 2022 16:49
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.

@bidoubiwa I left two 👀 because I would like to know if you will address/remove them in other PRs, or not :)

@bidoubiwa bidoubiwa merged commit 216638f into main Aug 3, 2022
@bidoubiwa bidoubiwa deleted the add_yaup_for_query_handling branch August 3, 2022 10:45
@bidoubiwa bidoubiwa added the skip-changelog The PR will not appear in the release changelogs label Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request skip-changelog The PR will not appear in the release changelogs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants