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 swapIndexes method #422

Conversation

brunoocasali
Copy link
Member

Add a new method in the Client client->swapIndexes(array $indexes) to swap indexes. The array should follow this structure: [['indexA', 'indexB'], ['indexC', 'indexD'], ...]

@brunoocasali brunoocasali added the enhancement New feature or request label Nov 23, 2022
Co-authored-by: Tomas Norkūnas <[email protected]>
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.

Tests are failing

Base automatically changed from bump-meilisearch-v0.30.0-add-cancel-tasks to bump-meilisearch-v0.30.0 November 24, 2022 16:00
@brunoocasali brunoocasali merged commit 20c35c8 into bump-meilisearch-v0.30.0 Nov 24, 2022
@brunoocasali brunoocasali deleted the bump-meilisearch-v0.30.0-add-swap-indexes branch November 24, 2022 18:50
bors bot added a commit that referenced this pull request Nov 28, 2022
428: Update version for the next release (v0.26.0) r=brunoocasali a=brunoocasali

This version makes this package compatible with Meilisearch v0.30.0 🎉
Check out the changelog of [Meilisearch v0.30.0](https://github.com/meilisearch/meilisearch/releases/tag/v0.30.0) for more information on the changes.

## 🚀 Enhancements
<details>
<summary>Add support to finite pagination (#418) `@brunoocasali` </summary>

Now you can call: 
- `$client.search('batman', [ 'page' => 1, 'hitsPerPage' => 10 ])`
- `$client.search('batman', [ 'hitsPerPage' => 10 ])`
- `$client.search('batman', [ 'page' => 4 ])`

`results = $client.search('batman', [ 'page' => 4 ])`

And get a limited pagination with a fixed number of total hits in the results object `results['totalHits']`.

You can still use the `offset/limit` by calling `$client.search('batman', [ 'limit' => 4, 'offset' => 10 ])`
`SearchResult#hitsCount` can still retrieve the total hits value.
</details>

<details>
<summary> Add <code>cancelTasks</code> method (#420) `@brunoocasali` </summary>
<br>
Allow users to cancel a processing or an enqueued task by using `cancelTasks(CancelTasksQuery $query)`

  ```php
  // CancelTasksQuery methods:
  setNext(int $next)
  setTypes(array $types)
  setStatuses(array $statuses)
  setIndexUids(array $indexUids)
  setUids(array $uids)
  setCanceledBy(array $canceledBy)
  setBeforeEnqueuedAt(\DateTime $date)
  setAfterEnqueuedAt(\DateTime $date)
  setBeforeStartedAt(\DateTime $date)
  setAfterStartedAt(\DateTime $date)
  setBeforeFinishedAt(\DateTime $date)
  setAfterFinishedAt(\DateTime $date)
  ```
</details>

<details>
<summary> Add <code>swapIndexes</code> method (#422) `@brunoocasali` </summary>
<br>
Add a new method in the Client client->swapIndexes(array $indexes) to swap indexes. The array should follow this structure: [['indexA', 'indexB'], ['indexC', 'indexD'], ...]
</details>

<details>
<summary> Add <code>deleteTasks</code> method (#423) `@brunoocasali` </summary>
<br>
Allow users to delete processed, failed, and canceled tasks.

A new method `deleteTasks(DeleteTasksQuery $query)`

```php
// DeleteTasksQuery methods:
setNext(int $next)
setTypes(array $types)
setStatuses(array $statuses)
setIndexUids(array $indexUids)
setUids(array $uids)
setCanceledBy(array $canceledBy)
setBeforeEnqueuedAt(\DateTime $date)
setAfterEnqueuedAt(\DateTime $date)
setBeforeStartedAt(\DateTime $date)
setAfterStartedAt(\DateTime $date)
setBeforeFinishedAt(\DateTime $date)
setAfterFinishedAt(\DateTime $date)
```
</details>

## ⚠️ Breaking Changes

- Add and Update filters to the `tasks` resource. (#419) `@brunoocasali` 
  - Added `setUids(array<int>)` filter to match by `Task.uid`.
  - Added `setCanceledBy(array<int>)` filter to match by `Task.canceledBy`
  - Added `setBeforeEnqueuedAt(\DateTime)` filter to match by `Task.beforeEnqueuedAt`
  - Added `setAfterEnqueuedAt(\DateTime)` filter to match by `Task.AfterEnqueuedAt`
  - Added `setBeforeStartedAt(\DateTime)` filter to match by `Task.beforeStartedAt`
  - Added `setAfterStartedAt(\DateTime)` filter to match by `Task.AfterStartedAt`
  - Added `setBeforeFinishedAt(\DateTime)` filter to match by `Task.beforeFinishedAt`
  - Added `setAfterFinishedAt(\DateTime)` filter to match by `Task.AfterFinishedAt`
  - ⚠️⚠️  Renamed `setUid(array)` to `setIndexUids(array)` filter to match by `Task.indexUid`
  - ⚠️⚠️  Renamed `setStatus(array)` to `setStatuses(array<string>)` filter to match by `Task.status`



Co-authored-by: Bruno Casali <[email protected]>
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.

3 participants