Skip to content

Commit 7890592

Browse files
meili-bors[bot]meili-botirevoirenorkunascurquiza
authored
Merge #658
658: Changes related to the next Meilisearch release (v1.10.0) r=brunoocasali a=meili-bot Related to this issue: meilisearch/integration-guides#302 This PR: - gathers the changes related to the next Meilisearch release (v1.10.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.10.0 is out. ⚠️ This PR should NOT be merged until the next release of Meilisearch (v1.10.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._ Co-authored-by: meili-bot <[email protected]> Co-authored-by: Tamo <[email protected]> Co-authored-by: Tomas Norkūnas <[email protected]> Co-authored-by: curquiza <[email protected]>
2 parents c4eb8ec + 211fd30 commit 7890592

15 files changed

+472
-86
lines changed

.code-samples.meilisearch.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,3 +744,29 @@ search_parameter_guide_matching_strategy_3: |-
744744
get_similar_post_1: |-
745745
$similarQuery = new SimilarDocumentsQuery('TARGET_DOCUMENT_ID');
746746
$client->index('INDEX_NAME')->getSimilar($similarQuery);
747+
multi_search_federated_1: |-
748+
$client->multiSearch([
749+
(new SearchQuery())
750+
->setIndexUid('movies'))
751+
->setQuery('batman')
752+
->setLimit(5),
753+
(new SearchQuery())
754+
->setIndexUid('comics')
755+
->setQuery('batman')
756+
->setLimit(5),
757+
],
758+
(new MultiSearchFederation())
759+
);
760+
search_parameter_reference_locales_1: |-
761+
$client->index('INDEX_NAME')->search('進撃の巨人', [
762+
'locales' => ['jpn']
763+
]);
764+
get_localized_attribute_settings_1: |-
765+
$client->index('INDEX_NAME')->getLocalizedAttributes();
766+
update_localized_attribute_settings_1: |-
767+
$client->index('INDEX_NAME')->updateLocalizedAttributes([
768+
'locales' => ['jpn'],
769+
'attributePatterns' => ['*_ja']
770+
]);
771+
reset_localized_attribute_settings_1: |-
772+
$client->index('INDEX_NAME')->resetLocalizedAttributes();
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
# This script is used in the SDK CIs to fetch the latest Meilisearch RC name (ex: v0.16.0rc2).
4+
# The Meilisearch RC is needed when maintainers are developing features during the pre-release week because the final Meilisearch release is not out yet.
5+
6+
temp_file='temp_file' # temp_file needed because `grep` would start before the download is over
7+
curl -s 'https://api.github.com/repos/meilisearch/meilisearch/releases' > "$temp_file"
8+
latest_rc_release=$(cat "$temp_file" \
9+
| grep -E 'tag_name' | grep 'rc' | head -1 \
10+
| tr -d ',"' | cut -d ':' -f2 | tr -d ' ')
11+
rm -rf "$temp_file"
12+
echo "$latest_rc_release"

.github/workflows/meilisearch-beta-tests.yml

Lines changed: 50 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,64 +11,80 @@ on:
1111
jobs:
1212
meilisearch-version:
1313
runs-on: ubuntu-latest
14-
outputs:
15-
version: ${{ steps.grep-step.outputs.version }}
1614
steps:
17-
- uses: actions/checkout@v4
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
1818
- name: Grep docker beta version of Meilisearch
1919
id: grep-step
2020
run: |
2121
MEILISEARCH_VERSION=$(sh .github/scripts/beta-docker-version.sh)
2222
echo $MEILISEARCH_VERSION
23-
echo ::set-output name=version::$MEILISEARCH_VERSION
23+
echo "version=$MEILISEARCH_VERSION" >> $GITHUB_OUTPUT
24+
outputs:
25+
version: ${{ steps.grep-step.outputs.version }}
26+
2427
tests:
2528
runs-on: ubuntu-latest
2629
needs: ['meilisearch-version']
30+
name: integration-tests-against-rc (PHP ${{ matrix.php-version }}) (${{ matrix.http-client }})
2731
services:
2832
meilisearch:
2933
image: getmeili/meilisearch:${{ needs.meilisearch-version.outputs.version }}
30-
env:
31-
MEILI_MASTER_KEY: 'masterKey'
32-
MEILI_NO_ANALYTICS: 'true'
3334
ports:
3435
- '7700:7700'
36+
env:
37+
MEILI_MASTER_KEY: masterKey
38+
MEILI_NO_ANALYTICS: true
3539
strategy:
3640
matrix:
37-
php-versions: ['7.4', '8.0', '8.1']
38-
name: integration-tests-against-rc (PHP ${{ matrix.php-versions }})
41+
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3']
42+
http-client: ['Guzzle-7', 'Guzzle-7-Adapter', 'Symfony-HttpClient', 'PHP-HTTP-CurlClient', 'Kriswallsmith-Buzz']
43+
exclude:
44+
- php-version: '7.4'
45+
http-client: 'Symfony-HttpClient'
46+
- php-version: '8.0'
47+
http-client: 'Symfony-HttpClient'
48+
- php-version: '8.1'
49+
http-client: 'Symfony-HttpClient'
50+
3951
steps:
40-
- uses: actions/checkout@v4
52+
- name: Checkout code
53+
uses: actions/checkout@v4
54+
4155
- name: Install PHP
4256
uses: shivammathur/setup-php@v2
4357
with:
4458
php-version: ${{ matrix.php-versions }}
59+
4560
- name: Validate composer.json and composer.lock
4661
run: composer validate
47-
- name: Install dependencies
48-
run: |
49-
composer remove --dev friendsofphp/php-cs-fixer --no-update --no-interaction
50-
composer install --prefer-dist --no-progress --no-suggest
51-
- name: Run test suite - default HTTP client (Guzzle 7)
52-
run: |
53-
sh scripts/tests.sh
54-
composer remove --dev guzzlehttp/guzzle http-interop/http-factory-guzzle
55-
- name: Run test suite - php-http/guzzle6-adapter
62+
63+
- name: Switch to Guzzle7 Adapter
64+
if: matrix.http-client == 'Guzzle-7-Adapter'
5665
run: |
57-
composer require --dev php-http/guzzle6-adapter http-interop/http-factory-guzzle
58-
sh scripts/tests.sh
59-
composer remove --dev php-http/guzzle6-adapter http-interop/http-factory-guzzle
60-
- name: Run test suite - symfony/http-client
66+
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"php-http\/guzzle7-adapter": "^1.0.0",/' composer.json
67+
68+
- name: Switch to Symfony HttpClient
69+
if: matrix.http-client == 'Symfony-HttpClient'
6170
run: |
62-
composer require --dev symfony/http-client nyholm/psr7
63-
sh scripts/tests.sh
64-
composer remove --dev symfony/http-client nyholm/psr7
65-
- name: Run test suite - php-http/curl-client
71+
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"symfony\/http-client": "^7.1.1",/' composer.json
72+
sed -i 's/"http-interop\/http-factory-guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"nyholm\/psr7": "^1.8.1",/' composer.json
73+
74+
- name: Switch to PHP HTTP CurlClient
75+
if: matrix.http-client == 'PHP-HTTP-CurlClient'
6676
run: |
67-
composer require --dev php-http/curl-client nyholm/psr7
68-
sh scripts/tests.sh
69-
composer remove --dev php-http/curl-client nyholm/psr7
70-
- name: Run test suite - kriswallsmith/buzz
77+
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"php-http\/curl-client": "^2.3.2",/' composer.json
78+
sed -i 's/"http-interop\/http-factory-guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"nyholm\/psr7": "^1.8.1",/' composer.json
79+
80+
- name: Switch to Kriswallsmith Buzz
81+
if: matrix.http-client == 'Kriswallsmith-Buzz'
7182
run: |
72-
composer require --dev kriswallsmith/buzz nyholm/psr7 --with-all-dependencies
73-
sh scripts/tests.sh
74-
composer remove --dev kriswallsmith/buzz nyholm/psr7
83+
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"kriswallsmith\/buzz": "^1.2.1",/' composer.json
84+
sed -i 's/"http-interop\/http-factory-guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"nyholm\/psr7": "^1.8.1",/' composer.json
85+
86+
- name: Install dependencies
87+
uses: ramsey/composer-install@v3
88+
89+
- name: Run test suite
90+
run: sh scripts/tests.sh

.github/workflows/pre-release-tests.yml

Lines changed: 87 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,83 +4,123 @@ name: Pre-Release Tests
44
# Will only run for PRs and pushes to bump-meilisearch-v*
55
on:
66
push:
7-
branches: bump-meilisearch-v*
7+
branches: ['bump-meilisearch-v*']
88
pull_request:
9-
branches: bump-meilisearch-v*
9+
branches: ['bump-meilisearch-v*']
1010

1111
jobs:
12+
meilisearch-version:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Grep docker latest rc version of Meilisearch
19+
id: grep-step
20+
run: |
21+
MEILISEARCH_VERSION=$(sh .github/scripts/get-latest-meilisearch-rc.sh)
22+
echo $MEILISEARCH_VERSION
23+
echo "version=$MEILISEARCH_VERSION" >> $GITHUB_OUTPUT
24+
outputs:
25+
version: ${{ steps.grep-step.outputs.version }}
26+
1227
tests:
1328
runs-on: ubuntu-latest
29+
needs: ['meilisearch-version']
30+
name: integration-tests-against-rc (PHP ${{ matrix.php-versions }})
31+
services:
32+
meilisearch:
33+
image: getmeili/meilisearch:${{ needs.meilisearch-version.outputs.version }}
34+
ports:
35+
- '7700:7700'
36+
env:
37+
MEILI_MASTER_KEY: masterKey
38+
MEILI_NO_ANALYTICS: true
1439
strategy:
1540
matrix:
16-
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3']
17-
name: integration-tests-against-rc (PHP ${{ matrix.php-versions }})
41+
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3']
42+
http-client: ['Guzzle-7', 'Guzzle-7-Adapter', 'Symfony-HttpClient', 'PHP-HTTP-CurlClient', 'Kriswallsmith-Buzz']
43+
exclude:
44+
- php-version: '7.4'
45+
http-client: 'Symfony-HttpClient'
46+
- php-version: '8.0'
47+
http-client: 'Symfony-HttpClient'
48+
- php-version: '8.1'
49+
http-client: 'Symfony-HttpClient'
1850
steps:
19-
- uses: actions/checkout@v4
51+
- name: Checkout code
52+
uses: actions/checkout@v4
53+
2054
- name: Install PHP
2155
uses: shivammathur/setup-php@v2
2256
with:
2357
php-version: ${{ matrix.php-versions }}
2458
coverage: none
59+
2560
- name: Validate composer.json and composer.lock
2661
run: composer validate
27-
- name: Install dependencies
28-
run: |
29-
composer remove --dev friendsofphp/php-cs-fixer --no-update --no-interaction
30-
composer install --prefer-dist --no-progress --no-suggest
31-
- name: Get the latest Meilisearch RC
32-
run: echo "MEILISEARCH_VERSION=$(curl https://raw.githubusercontent.com/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | bash)" >> $GITHUB_ENV
33-
- name: Meilisearch (${{ env.MEILISEARCH_VERSION }}) setup with Docker
34-
run: docker run -d -p 7700:7700 getmeili/meilisearch:${{ env.MEILISEARCH_VERSION }} meilisearch --master-key=masterKey --no-analytics
35-
- name: Run test suite - default HTTP client (Guzzle 7)
36-
run: |
37-
sh scripts/tests.sh
38-
composer remove --dev guzzlehttp/guzzle http-interop/http-factory-guzzle
39-
- name: Run test suite - php-http/guzzle7-adapter
62+
63+
- name: Switch to Guzzle7 Adapter
64+
if: matrix.http-client == 'Guzzle-7-Adapter'
4065
run: |
41-
composer require --dev php-http/guzzle7-adapter http-interop/http-factory-guzzle
42-
sh scripts/tests.sh
43-
composer remove --dev php-http/guzzle7-adapter http-interop/http-factory-guzzle
44-
- name: Run test suite - symfony/http-client
66+
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"php-http\/guzzle7-adapter": "^1.0.0",/' composer.json
67+
68+
- name: Switch to Symfony HttpClient
69+
if: matrix.http-client == 'Symfony-HttpClient'
4570
run: |
46-
composer require --dev symfony/http-client nyholm/psr7
47-
sh scripts/tests.sh
48-
composer remove --dev symfony/http-client nyholm/psr7
49-
- name: Run test suite - php-http/curl-client
71+
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"symfony\/http-client": "^7.1.1",/' composer.json
72+
sed -i 's/"http-interop\/http-factory-guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"nyholm\/psr7": "^1.8.1",/' composer.json
73+
74+
- name: Switch to PHP HTTP CurlClient
75+
if: matrix.http-client == 'PHP-HTTP-CurlClient'
5076
run: |
51-
composer require --dev php-http/curl-client nyholm/psr7
52-
sh scripts/tests.sh
53-
composer remove --dev php-http/curl-client nyholm/psr7
54-
- name: Run test suite - kriswallsmith/buzz
77+
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"php-http\/curl-client": "^2.3.2",/' composer.json
78+
sed -i 's/"http-interop\/http-factory-guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"nyholm\/psr7": "^1.8.1",/' composer.json
79+
80+
- name: Switch to Kriswallsmith Buzz
81+
if: matrix.http-client == 'Kriswallsmith-Buzz'
5582
run: |
56-
composer require --dev kriswallsmith/buzz nyholm/psr7 --with-all-dependencies
57-
composer update php-http/client-common:2.6.0 php-http/httplug:2.3.0 psr/http-message
58-
sh scripts/tests.sh
59-
composer remove --dev kriswallsmith/buzz nyholm/psr7
83+
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"kriswallsmith\/buzz": "^1.2.1",/' composer.json
84+
sed -i 's/"http-interop\/http-factory-guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"nyholm\/psr7": "^1.8.1",/' composer.json
85+
86+
- name: Install dependencies
87+
uses: ramsey/composer-install@v3
88+
89+
- name: Run test suite
90+
run: sh scripts/tests.sh
6091

6192
test_php_7_guzzle_6:
6293
runs-on: ubuntu-latest
94+
needs: ['meilisearch-version']
6395
name: integration-tests-against-rc (PHP 7.4 & Guzzle 6)
96+
services:
97+
meilisearch:
98+
image: getmeili/meilisearch:${{ needs.meilisearch-version.outputs.version }}
99+
env:
100+
MEILI_MASTER_KEY: 'masterKey'
101+
MEILI_NO_ANALYTICS: 'true'
102+
ports:
103+
- '7700:7700'
104+
64105
steps:
65-
- uses: actions/checkout@v4
106+
- name: Checkout code
107+
uses: actions/checkout@v4
108+
66109
- name: Install PHP
67110
uses: shivammathur/setup-php@v2
68111
with:
69112
php-version: '7.4'
70113
coverage: none
114+
71115
- name: Validate composer.json and composer.lock
72116
run: composer validate
73-
- name: Install dependencies
117+
118+
- name: Switch to Guzzle 6
74119
run: |
75-
composer remove --dev friendsofphp/php-cs-fixer --no-update --no-interaction
76-
composer update --prefer-dist --no-progress
77-
composer remove --dev guzzlehttp/guzzle http-interop/http-factory-guzzle
78-
composer update php-http/client-common:2.6.0 php-http/httplug:2.3.0 psr/http-message
79-
- name: Get the latest Meilisearch RC
80-
run: echo "MEILISEARCH_VERSION=$(curl https://raw.githubusercontent.com/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | bash)" >> $GITHUB_ENV
81-
- name: Meilisearch (${{ env.MEILISEARCH_VERSION }}) setup with Docker
82-
run: docker run -d -p 7700:7700 getmeili/meilisearch:${{ env.MEILISEARCH_VERSION }} meilisearch --master-key=masterKey --no-analytics
120+
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"php-http\/guzzle6-adapter": "^2.0.2",/' composer.json
121+
122+
- name: Install dependencies
123+
uses: ramsey/composer-install@v3
124+
83125
- name: Run test suite - php-http/guzzle6-adapter
84-
run: |
85-
composer require --dev php-http/guzzle6-adapter http-interop/http-factory-guzzle
86-
sh scripts/tests.sh
126+
run: sh scripts/tests.sh

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,12 @@ jobs:
6666
# Will still run for each push to bump-meilisearch-v*
6767
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
6868
runs-on: ubuntu-latest
69+
name: integration-tests (PHP ${{ matrix.php-version }}) (${{ matrix.http-client }})
6970
services:
7071
meilisearch:
7172
image: getmeili/meilisearch:latest
7273
ports:
73-
- 7700:7700
74+
- '7700:7700'
7475
env:
7576
MEILI_MASTER_KEY: masterKey
7677
MEILI_NO_ANALYTICS: true
@@ -86,7 +87,6 @@ jobs:
8687
- php-version: '8.1'
8788
http-client: 'Symfony-HttpClient'
8889

89-
name: integration-tests (PHP ${{ matrix.php-version }}) (${{ matrix.http-client }})
9090
steps:
9191
- uses: actions/checkout@v4
9292

src/Contracts/FederationOptions.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Meilisearch\Contracts;
6+
7+
class FederationOptions
8+
{
9+
private ?float $weight = null;
10+
11+
public function setWeight(float $weight): FederationOptions
12+
{
13+
$this->weight = $weight;
14+
15+
return $this;
16+
}
17+
18+
public function toArray(): array
19+
{
20+
return array_filter([
21+
'weight' => $this->weight,
22+
], static function ($item) { return null !== $item; });
23+
}
24+
}

0 commit comments

Comments
 (0)