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

Add filtering on deleteDocuments for Meilisearch v1.2 #1492

Merged
merged 5 commits into from May 29, 2023

Conversation

bidoubiwa
Copy link
Contributor

As per the specification: meilisearch/specifications#236

  • deleteDocuments now accepts two types of parameter.
    • An array of document ids
    • An object containing a filter field. NEW

The filter field works precisely like the filter field used on the search method. See the docs on how to use filters.

@bidoubiwa bidoubiwa added the enhancement New feature or request label May 16, 2023
@bidoubiwa bidoubiwa force-pushed the delete-documents-by-filter-ms-v1.2 branch 2 times, most recently from 12f64f7 to eada8aa Compare May 16, 2023 15:56
@bidoubiwa bidoubiwa changed the title Add delete documents by filter for Meilisearch v1.2 Add filtering on deleteDocuments for Meilisearch v1.2 May 16, 2023
@bidoubiwa bidoubiwa force-pushed the delete-documents-by-filter-ms-v1.2 branch from eada8aa to ce7d1a8 Compare May 16, 2023 16:35
src/indexes.ts Outdated Show resolved Hide resolved
src/indexes.ts Show resolved Hide resolved
@bidoubiwa bidoubiwa force-pushed the delete-documents-by-filter-ms-v1.2 branch from ce7d1a8 to a0aa068 Compare May 17, 2023 09:25
@bidoubiwa bidoubiwa changed the base branch from bump-meilisearch-v1.2.0 to get-documents-by-filter-ms-v1.2 May 17, 2023 09:25
const url = `indexes/${this.uid}/${endpoint}`

try {
const task = await this.httpRequest.post(url, params)
Copy link
Member

Choose a reason for hiding this comment

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

Does the response of this post method vary?

Copy link
Member

Choose a reason for hiding this comment

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

I thought it could be only a task.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is always a task, but if the request fails it goes to the catch

Copy link
Member

Choose a reason for hiding this comment

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

So, why do you need to create a new instance of the task? Since it is already returned?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One is a plain object one is an instance of the Task Class

@bidoubiwa bidoubiwa force-pushed the get-documents-by-filter-ms-v1.2 branch from 9c2ec7e to 2e11694 Compare May 24, 2023 12:43
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.

LGTM! 🎉 🎉 🌴

@brunoocasali
Copy link
Member

btw, can you cleanup the commit history?

image

@bidoubiwa bidoubiwa force-pushed the get-documents-by-filter-ms-v1.2 branch from 2e11694 to 37c550b Compare May 25, 2023 10:25
@bidoubiwa bidoubiwa force-pushed the delete-documents-by-filter-ms-v1.2 branch 3 times, most recently from 3c07b9e to c6f42e8 Compare May 25, 2023 10:31
@bidoubiwa bidoubiwa force-pushed the get-documents-by-filter-ms-v1.2 branch from 37c550b to d079011 Compare May 25, 2023 11:08
@bidoubiwa bidoubiwa force-pushed the get-documents-by-filter-ms-v1.2 branch from d079011 to 7f927d0 Compare May 25, 2023 16:55
@bidoubiwa bidoubiwa force-pushed the delete-documents-by-filter-ms-v1.2 branch from 44daf9e to bf30887 Compare May 25, 2023 16:58
@bidoubiwa bidoubiwa force-pushed the delete-documents-by-filter-ms-v1.2 branch from bf30887 to 1be343f Compare May 25, 2023 18:40
@bidoubiwa bidoubiwa force-pushed the get-documents-by-filter-ms-v1.2 branch from 7f927d0 to 19746b1 Compare May 25, 2023 18:40
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.

LGTM!

Base automatically changed from get-documents-by-filter-ms-v1.2 to bump-meilisearch-v1.2.0 May 29, 2023 12:31
@bidoubiwa bidoubiwa merged commit 0456d3e into bump-meilisearch-v1.2.0 May 29, 2023
7 checks passed
@bidoubiwa bidoubiwa deleted the delete-documents-by-filter-ms-v1.2 branch May 29, 2023 12:59
meili-bors bot added a commit that referenced this pull request Jun 5, 2023
1501: Update version for the next release (v0.33.0) r=bidoubiwa 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 first parameter of the method `deleteDocuments(params)` now supports two different types. Either an array of document ID's or an object containing a `filter` field. The `filter` field works precisely like the `filter` field used on the `search` method (see [the docs on how to use filters](https://www.meilisearch.com/docs/learn/advanced/filtering#filter-basics)) and lets you determine which documents should be deleted. ⚠️ Still, even being supported, the ability to receive an array of document ID's is deprecated and should be changed to an object containing the filter field. #1492 `@bidoubiwa` 

- `getDocuments(parameters: DocumentsQuery)`, now accepts a new `filter` field to filter the documents you'd like to fetch. The `filter` field works precisely like the `filter` field used on the `search` method (see [the docs on how to use filters](https://www.meilisearch.com/docs/learn/advanced/filtering#filter-basics)). #1493 `@bidoubiwa` 

These feature requires a Meilisearch server version greater than v1.2.

Thanks again to `@bidoubiwa!` 🎉

1504: Update code-samples for v1.2 r=bidoubiwa a=meili-bot

_This PR is auto-generated._

Update the code-samples.meilisearch.yml according to the [integration-guides issue](meilisearch/integration-guides#270) for more information and the complete description about what should be done here check that issue.
This is the [central issue](meilisearch/integration-guides#261) about the Meilisearch release v1.2 in the integrations.


Co-authored-by: meili-bot <74670311+meili-bot@users.noreply.github.com>
Co-authored-by: Charlotte Vermandel <charlottevermandel@gmail.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

2 participants