-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
692: Changes related to the next Meilisearch release (v1.12.0) r=curquiza a=meili-bot Related to this issue: meilisearch/integration-guides#307 This PR: - gathers the changes related to the next Meilisearch release (v1.12.0) so that this package is ready when the official release is out. - should pass the tests against the [latest pre-release of Meilisearch](https://github.com/meilisearch/meilisearch/releases). - might eventually contain test failures until the Meilisearch v1.12.0 is out.⚠️ This PR should NOT be merged until the next release of Meilisearch (v1.12.0) is out. _This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/main/resources/pre-release-week.md) purpose._ 705: Update version for the next release (v1.12.0) r=curquiza a=meili-bot _This PR is auto-generated._ The automated script updates the version of meilisearch-php to a new version: "v1.12.0" CHANGELOGS 👇 This version introduces features released on Meilisearch v1.12.0 🎉 Check out the [Meilisearch v1.12.0 changelog](https://github.com/meilisearch/meilisearch/releases/tag/v1.12.0) for more information. ## 🚀 Enhancements - **Addition:** #699 Introducing new methods to get one or several batches, respectively `getBatch()` and `getBatches()`. A batch is a set of tasks processed together. - **Addition:** #698 The `TaskQuery` class now has a `setReverse()` method to retrieve tasks in reverse chronological order. ```php client->getTasks((new TasksQuery())->setReverse(true)); ``` - **Addition:** #702 Index settings now allow disabling **prefix search** and **facet search**. They're both enabled by default. The SDK now comes with dedicated methods to configure these settings. ```php // disable prefix search $index->updatePrefixSearch('disabled'); // reset prefix search settings $index->resetPrefixSearch(); // disable facet search $index->updateFacetSearch(false); // reset facet search settings $index->resetFacetSearch(); ``` ## 🐛 Bug Fixes - fix: pull the latest in the CI instead of forcing the v1.11 (#691) `@/mdubus` - Make `hitsCount` always the number of `hits` (and not `totalHits` value) (#701) `@/johnnynotsolucky` ## ⚙️ Maintenance/misc - Update CI to run with PHP 8.4 (#696) `@/norkunas` - Fixed SearchNestedFieldsTest test (#704) `@/aivchen` - PHPStan 2 + fixed uninitialized properties in SearchResult (#706) `@/aivchen` Thanks again to `@/aivchen,` `@/johnnynotsolucky,` `@/mdubus,` `@/norkunas,` Andrei Ivchenkov, and `@/Strift!` 🎉 Co-authored-by: meili-bot <[email protected]> Co-authored-by: Clémentine <[email protected]> Co-authored-by: Strift <[email protected]> Co-authored-by: Laurent Cazanove <[email protected]>
- Loading branch information
Showing
15 changed files
with
541 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Meilisearch\Contracts; | ||
|
||
use Meilisearch\Endpoints\Delegates\TasksQueryTrait; | ||
|
||
class BatchesQuery | ||
{ | ||
use TasksQueryTrait; | ||
|
||
private ?int $from = null; | ||
|
||
/** | ||
* @var non-negative-int|null | ||
*/ | ||
private ?int $limit = null; | ||
|
||
private ?bool $reverse = null; | ||
|
||
/** | ||
* @return $this | ||
*/ | ||
public function setFrom(int $from): self | ||
{ | ||
$this->from = $from; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return $this | ||
*/ | ||
public function setLimit(int $limit): self | ||
{ | ||
$this->limit = $limit; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return $this | ||
*/ | ||
public function setReverse(bool $reverse): self | ||
{ | ||
$this->reverse = $reverse; | ||
|
||
return $this; | ||
} | ||
|
||
public function toArray(): array | ||
{ | ||
return array_filter( | ||
array_merge( | ||
$this->baseArray(), | ||
[ | ||
'from' => $this->from, | ||
'limit' => $this->limit, | ||
'reverse' => (null !== $this->reverse ? ($this->reverse ? 'true' : 'false') : null), | ||
] | ||
), | ||
static function ($item) { | ||
return null !== $item; | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Meilisearch\Contracts; | ||
|
||
class BatchesResults extends Data | ||
{ | ||
/** | ||
* @var non-negative-int | ||
*/ | ||
private int $next; | ||
|
||
/** | ||
* @var non-negative-int | ||
*/ | ||
private int $limit; | ||
|
||
/** | ||
* @var non-negative-int | ||
*/ | ||
private int $from; | ||
|
||
/** | ||
* @var non-negative-int | ||
*/ | ||
private int $total; | ||
|
||
public function __construct(array $params) | ||
{ | ||
parent::__construct($params['results']); | ||
|
||
$this->from = $params['from'] ?? 0; | ||
$this->limit = $params['limit'] ?? 0; | ||
$this->next = $params['next'] ?? 0; | ||
$this->total = $params['total'] ?? 0; | ||
} | ||
|
||
/** | ||
* @return array<int, array> | ||
*/ | ||
public function getResults(): array | ||
{ | ||
return $this->data; | ||
} | ||
|
||
/** | ||
* @return non-negative-int | ||
*/ | ||
public function getNext(): int | ||
{ | ||
return $this->next; | ||
} | ||
|
||
/** | ||
* @return non-negative-int | ||
*/ | ||
public function getLimit(): int | ||
{ | ||
return $this->limit; | ||
} | ||
|
||
/** | ||
* @return non-negative-int | ||
*/ | ||
public function getFrom(): int | ||
{ | ||
return $this->from; | ||
} | ||
|
||
/** | ||
* @return non-negative-int | ||
*/ | ||
public function getTotal(): int | ||
{ | ||
return $this->total; | ||
} | ||
|
||
public function toArray(): array | ||
{ | ||
return [ | ||
'results' => $this->data, | ||
'next' => $this->next, | ||
'limit' => $this->limit, | ||
'from' => $this->from, | ||
'total' => $this->total, | ||
]; | ||
} | ||
|
||
public function count(): int | ||
{ | ||
return \count($this->data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Meilisearch\Endpoints; | ||
|
||
use Meilisearch\Contracts\Endpoint; | ||
|
||
class Batches extends Endpoint | ||
{ | ||
protected const PATH = '/batches'; | ||
|
||
public function get($batchUid): array | ||
{ | ||
return $this->http->get(self::PATH.'/'.$batchUid); | ||
} | ||
|
||
public function all(array $query = []): array | ||
{ | ||
return $this->http->get(self::PATH.'/', $query); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Meilisearch\Endpoints\Delegates; | ||
|
||
use Meilisearch\Contracts\BatchesQuery; | ||
use Meilisearch\Contracts\BatchesResults; | ||
use Meilisearch\Endpoints\Batches; | ||
|
||
trait HandlesBatches | ||
{ | ||
protected Batches $batches; | ||
|
||
public function getBatch($uid): array | ||
{ | ||
return $this->batches->get($uid); | ||
} | ||
|
||
public function getBatches(?BatchesQuery $options = null): BatchesResults | ||
{ | ||
$query = null !== $options ? $options->toArray() : []; | ||
|
||
$response = $this->batches->all($query); | ||
|
||
return new BatchesResults($response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.