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 method DeleteDocumentsByFilter for Meilisearch v1.2 #440

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

alallema
Copy link
Contributor

@alallema alallema commented May 24, 2023

As per the specification: meilisearch/specifications#236

Added method DeleteDocumentsByFilter, this method takes an interface{} which allows you to send different types of filters (string, []string, []interface{}{[]string{}}, ...)

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

@alallema alallema added the enhancement New feature or request label May 24, 2023
@alallema alallema changed the base branch from get-documents-by-filter to bump-meilisearch-v1.2.0 May 24, 2023 15:34
@alallema alallema changed the base branch from bump-meilisearch-v1.2.0 to get-documents-by-filter May 24, 2023 15:35
@alallema alallema force-pushed the delete-documents-by-filter branch from d1a71a0 to cbbf7a8 Compare May 24, 2023 15:38
@alallema alallema changed the base branch from get-documents-by-filter to bump-meilisearch-v1.2.0 May 24, 2023 15:39
client: defaultClient,
filterToApply: []string{"book_id"},
filterToDelete: "book_id = 123",
documentsPtr: []docTestBooks{
Copy link
Member

Choose a reason for hiding this comment

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

What does ptr mean?

Copy link
Contributor Author

@alallema alallema May 29, 2023

Choose a reason for hiding this comment

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

These are auto-generated tests, I think it's for pointers.

index_documents.go Show resolved Hide resolved
Comment on lines +541 to +545
}
if err := i.client.executeRequest(req); err != nil {
return nil, VersionErrorHintMessage(err, &req)
}
return resp, nil
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
}
if err := i.client.executeRequest(req); err != nil {
return nil, VersionErrorHintMessage(err, &req)
}
return resp, nil
}
if err := i.client.executeRequest(req); err != nil {
return nil, VersionErrorHintMessage(err, &req)
}
return resp, nil

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can change it but all the others are formatted the same way

index_documents.go Show resolved Hide resolved
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!

@alallema alallema merged commit 92887ba into bump-meilisearch-v1.2.0 Jun 1, 2023
@alallema alallema deleted the delete-documents-by-filter branch June 1, 2023 10:30
meili-bors bot added a commit that referenced this pull request Jun 5, 2023
441: Update version for the next release (v0.25.0) r=alallema 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

- Addition of the method `DeleteDocumentsByFilter`, this method takes an `interface{}` which allows you to send different types of filters (`string`, `[]string`, `[]interface{}{[]string{}}`, ...). 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). #440 `@alallema`

  ⚠️ You must configure the attributes you want to filter using the `Index.UpdateFilterableAttributes()`.
  ⚠️ Remember to **update your Meilisearch server to v1.2.0 or newer before** adopting it.

- Add the ability to add `Filter` in the `DocumentsQuery`. When a query with a `filter` is sent to `getDocuments`, it will filter the documents like the `search` method. See [the docs on how to use filters](https://www.meilisearch.com/docs/learn/advanced/filtering#filter-basics). #439 `@alallema` 
  
  ⚠️ You must configure the attributes you want to filter using the `Index.UpdateFilterableAttributes()`.
  ⚠️ Remember to **update your Meilisearch server to v1.2.0 or newer before** adopting it.

Thanks again to `@alallema,` `@curquiza` ! 🎉

Co-authored-by: meili-bot <74670311+meili-bot@users.noreply.github.com>
Co-authored-by: Amélie <alallema@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

2 participants