From a1a414ed0c912c2c6dbfc96994218059a2a6559d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Nork=C5=ABnas?= Date: Wed, 4 Dec 2024 16:45:42 +0200 Subject: [PATCH 1/3] Update CI to run with PHP 8.4 (#696) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Clémentine --- .github/workflows/meilisearch-beta-tests.yml | 2 +- .github/workflows/pre-release-tests.yml | 2 +- .github/workflows/tests.yml | 8 +++++--- bors.toml | 6 ++++++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/meilisearch-beta-tests.yml b/.github/workflows/meilisearch-beta-tests.yml index eb971144..5e23fcfa 100644 --- a/.github/workflows/meilisearch-beta-tests.yml +++ b/.github/workflows/meilisearch-beta-tests.yml @@ -38,7 +38,7 @@ jobs: MEILI_NO_ANALYTICS: true strategy: matrix: - php-version: ['7.4', '8.0', '8.1', '8.2', '8.3'] + php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] http-client: ['Guzzle-7', 'Guzzle-7-Adapter', 'Symfony-HttpClient', 'PHP-HTTP-CurlClient', 'Kriswallsmith-Buzz'] exclude: - php-version: '7.4' diff --git a/.github/workflows/pre-release-tests.yml b/.github/workflows/pre-release-tests.yml index 2a533a7d..e12a7136 100644 --- a/.github/workflows/pre-release-tests.yml +++ b/.github/workflows/pre-release-tests.yml @@ -38,7 +38,7 @@ jobs: MEILI_NO_ANALYTICS: true strategy: matrix: - php-version: ['7.4', '8.0', '8.1', '8.2', '8.3'] + php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] http-client: ['Guzzle-7', 'Guzzle-7-Adapter', 'Symfony-HttpClient', 'PHP-HTTP-CurlClient', 'Kriswallsmith-Buzz'] exclude: - php-version: '7.4' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ebd08f7b..2bc67c2f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,6 +26,8 @@ jobs: lint: runs-on: ubuntu-latest name: linter-check + env: + PHP_CS_FIXER_IGNORE_ENV: 1 steps: - name: Checkout code uses: actions/checkout@v4 @@ -33,7 +35,7 @@ jobs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 coverage: none - name: Install dependencies @@ -52,7 +54,7 @@ jobs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.2 + php-version: 8.4 coverage: none - name: Install dependencies @@ -77,7 +79,7 @@ jobs: MEILI_NO_ANALYTICS: true strategy: matrix: - php-version: ['7.4', '8.0', '8.1', '8.2', '8.3'] + php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] http-client: ['Guzzle-7', 'Guzzle-7-Adapter', 'Symfony-HttpClient', 'PHP-HTTP-CurlClient', 'Kriswallsmith-Buzz'] exclude: - php-version: '7.4' diff --git a/bors.toml b/bors.toml index ccf5ad27..2eac0386 100644 --- a/bors.toml +++ b/bors.toml @@ -28,6 +28,12 @@ status = [ 'integration-tests (PHP 8.3) (Symfony-HttpClient)', 'integration-tests (PHP 8.3) (PHP-HTTP-CurlClient)', 'integration-tests (PHP 8.3) (Kriswallsmith-Buzz)', + + 'integration-tests (PHP 8.4) (Guzzle-7)', + 'integration-tests (PHP 8.4) (Guzzle-7-Adapter)', + 'integration-tests (PHP 8.4) (Symfony-HttpClient)', + 'integration-tests (PHP 8.4) (PHP-HTTP-CurlClient)', + 'integration-tests (PHP 8.4) (Kriswallsmith-Buzz)', ] # 1 hour timeout timeout-sec = 3600 From 2e80226680c41936ccf514b60e6696657bff31d9 Mon Sep 17 00:00:00 2001 From: Tyrone Tudehope Date: Thu, 5 Dec 2024 10:26:58 +0200 Subject: [PATCH 2/3] Ensure that hitsCount value is consistent --- src/Search/SearchResult.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Search/SearchResult.php b/src/Search/SearchResult.php index d54c9bea..225197a6 100644 --- a/src/Search/SearchResult.php +++ b/src/Search/SearchResult.php @@ -58,7 +58,6 @@ public function __construct(array $body) $this->offset = $body['offset']; $this->limit = $body['limit']; $this->estimatedTotalHits = $body['estimatedTotalHits']; - $this->hitsCount = \count($body['hits']); } else { $this->numberedPagination = true; @@ -66,11 +65,11 @@ public function __construct(array $body) $this->page = $body['page']; $this->totalPages = $body['totalPages']; $this->totalHits = $body['totalHits']; - $this->hitsCount = $body['totalHits']; } $this->semanticHitCount = $body['semanticHitCount'] ?? 0; $this->hits = $body['hits'] ?? []; + $this->hitsCount = \count($body['hits']); $this->processingTimeMs = $body['processingTimeMs']; $this->query = $body['query']; $this->facetDistribution = $body['facetDistribution'] ?? []; From 43b0f45a367db843c6fe7fbcdeafeb3fbabaeeb2 Mon Sep 17 00:00:00 2001 From: Andrei Ivchenkov Date: Wed, 11 Dec 2024 01:18:15 +0300 Subject: [PATCH 3/3] Fixed SearchNestedFieldsTest test --- ...NestedFields.php => SearchNestedFieldsTest.php} | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) rename tests/Endpoints/{SearchTestNestedFields.php => SearchNestedFieldsTest.php} (90%) diff --git a/tests/Endpoints/SearchTestNestedFields.php b/tests/Endpoints/SearchNestedFieldsTest.php similarity index 90% rename from tests/Endpoints/SearchTestNestedFields.php rename to tests/Endpoints/SearchNestedFieldsTest.php index 11b3af9b..f98d6875 100644 --- a/tests/Endpoints/SearchTestNestedFields.php +++ b/tests/Endpoints/SearchNestedFieldsTest.php @@ -7,7 +7,7 @@ use Meilisearch\Endpoints\Indexes; use Tests\TestCase; -final class SearchTestNestedFields extends TestCase +final class SearchNestedFieldsTest extends TestCase { private Indexes $index; @@ -16,7 +16,7 @@ protected function setUp(): void parent::setUp(); $this->index = $this->createEmptyIndex($this->safeIndexName('nestedIndex')); $promise = $this->index->updateDocuments(self::NESTED_DOCUMENTS); - $this->index->waitForTask($promise['uid']); + $this->index->waitForTask($promise['taskUid']); } public function testBasicSearchOnNestedFields(): void @@ -48,7 +48,7 @@ public function testSearchOnNestedFieldWithMultiplesResultsOnNestedFields(): voi self::assertArrayHasKey('hits', $response); self::assertSame(6, $response['estimatedTotalHits']); - self::assertSame(4, $response['hits'][0]['id']); + self::assertSame(1, $response['hits'][0]['id']); } public function testSearchOnNestedFieldWithOptions(): void @@ -62,13 +62,13 @@ public function testSearchOnNestedFieldWithOptions(): void ]); self::assertCount(1, $response['hits']); - self::assertSame(4, $response['hits'][0]['id']); + self::assertSame(1, $response['hits'][0]['id']); } public function testSearchOnNestedFieldWithSearchableAtributes(): void { $response = $this->index->updateSearchableAttributes(['title', 'info.comment']); - $this->index->waitForTask($response['uid']); + $this->index->waitForTask($response['taskUid']); $response = $this->index->search('An awesome'); @@ -87,7 +87,7 @@ public function testSearchOnNestedFieldWithSearchableAtributes(): void public function testSearchOnNestedFieldWithSortableAtributes(): void { $response = $this->index->updateSortableAttributes(['info.reviewNb']); - $this->index->waitForTask($response['uid']); + $this->index->waitForTask($response['taskUid']); $response = $this->index->search('An awesome'); @@ -111,7 +111,7 @@ public function testSearchOnNestedFieldWithSortableAtributesAndSearchableAttribu 'searchableAttributes' => ['title', 'info.comment'], 'sortableAttributes' => ['info.reviewNb'], ]); - $this->index->waitForTask($response['uid']); + $this->index->waitForTask($response['taskUid']); $response = $this->index->search('An awesome');