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

Delete documents by filter #438

Merged
merged 7 commits into from
May 22, 2023

Conversation

brunoocasali
Copy link
Member

@brunoocasali brunoocasali commented May 19, 2023

The method delete_documents() now supports a different behavior. This method could take an options hash containing a filter: key/value object to filter the documents or a simple array or single value as usual.

⚠️ Still, even being supported, the ability to receive other types than a hash is deprecated and should be changed to a filter.

Introduce a way of handling the exceptions before being raised to be able to add a custom message where we give the user a hint of where the error is (version related).
This is how the error will look like when the user tries to call a delete by filters when using an old Meilisearch version:

image

@brunoocasali brunoocasali changed the base branch from main to bump-meilisearch-v1.2.0 May 19, 2023 21:23
This will increase the DX when the user tries to use a route method
that are not defined in the current Meilisearch instance they are using.
@brunoocasali brunoocasali added the enhancement New feature or request label May 20, 2023
@brunoocasali
Copy link
Member Author

@bidoubiwa here on the Ruby SDK, the Meili errors are always MeiliSearch::ApiError so I'll give the hint anyways.

Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

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

My approval cannot count as an official one, but I've checked the method and looks good to me

It's also a good addition to improve the error message, definitely useful 👌

@brunoocasali
Copy link
Member Author

@bidoubiwa I'm going to merge this, and also the get_documents, since I addressed all of your concerns ;)

@brunoocasali brunoocasali merged commit 3eb2d12 into bump-meilisearch-v1.2.0 May 22, 2023
5 checks passed
@brunoocasali brunoocasali deleted the delete-documents-by-filter branch May 22, 2023 19:43
Copy link
Contributor

@bidoubiwa bidoubiwa left a comment

Choose a reason for hiding this comment

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

LGTM :)

meili-bors bot added a commit that referenced this pull request Jun 5, 2023
440: Update version for the next release (v0.24.0) r=brunoocasali a=meili-bot

Release CHANGELOG:

This version introduces features released on Meilisearch v1.2.0 🎉
Check out the changelog of [Meilisearch v1.2.0](https://github.com/meilisearch/meilisearch/releases/tag/v1.2.0) for more information on the changes. 
⚠️ If you want to adopt new features of this release, **update the Meilisearch server** to the according version.

### 🚀 Enhancements

- The method `delete_documents()` now supports a different behavior. This method could take an `options` hash containing a `filter:` key/value object to filter the documents or a simple array or single value as usual.
⚠️ Still, even being supported, the ability to receive other types than a hash is deprecated and should be changed to a filter. Please use `filter` instead.
#438 `@brunoocasali` 

- When a query with a `filter` key is sent to `get_documents(options = {})` it will filter the documents like the `search` method. This feature requires a Meilisearch server version greater than v1.2. See [the docs on how to use filters](https://www.meilisearch.com/docs/learn/advanced/filtering#filter-basics). #439 `@brunoocasali` 

Thanks again to `@brunoocasali!` 🎉

Co-authored-by: meili-bot <74670311+meili-bot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants