Skip to content

Commit 72c6f4a

Browse files
Merge #331
331: SearchCutoffMs setting r=curquiza a=norkunas # Pull Request ## Related issue Fixes #<issue_number> ## What does this PR do? - Adds support for searchCutoffMs setting ## PR checklist Please check if your PR fulfills the following requirements: - [ ] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? - [x] Have you read the contributing guidelines? - [x] Have you made sure that the title is accurate and descriptive of the changes? Co-authored-by: Tomas <[email protected]>
2 parents 08684f0 + a7077ee commit 72c6f4a

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

Diff for: src/DependencyInjection/Configuration.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function getConfigTreeBuilder(): TreeBuilder
6464
->beforeNormalization()
6565
->always()
6666
->then(static function (array $value) {
67-
$stringSettings = ['distinctAttribute', 'proximityPrecision'];
67+
$stringSettings = ['distinctAttribute', 'proximityPrecision', 'searchCutoffMs'];
6868

6969
foreach ($stringSettings as $setting) {
7070
if (isset($value[$setting]) && !is_array($value[$setting])) {

Diff for: src/Services/SettingsUpdater.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function update(string $indice, ?int $responseTimeout = null): void
5858

5959
if (isset($value['_service']) && $value['_service'] instanceof SettingsProvider) {
6060
$value = $value['_service']();
61-
} elseif (('distinctAttribute' === $variable || 'proximityPrecision' === $variable) && is_array($value)) {
61+
} elseif (('distinctAttribute' === $variable || 'proximityPrecision' === $variable || 'searchCutoffMs' === $variable) && is_array($value)) {
6262
$value = $value[0] ?? null;
6363
}
6464

Diff for: tests/Integration/CommandsTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public function testSearchImportAndClearAndDeleteWithoutIndices(): void
7575
Settings updated of "sf_phpunit__posts".
7676
Settings updated of "sf_phpunit__posts".
7777
Settings updated of "sf_phpunit__posts".
78+
Settings updated of "sf_phpunit__posts".
7879
Importing for index Meilisearch\Bundle\Tests\Entity\Comment
7980
Importing for index Meilisearch\Bundle\Tests\Entity\Tag
8081
Indexed a batch of 6 / 6 Meilisearch\Bundle\Tests\Entity\Tag entities into sf_phpunit__tags index (6 indexed since start)
@@ -383,6 +384,7 @@ public function testSearchCreateWithoutIndices(bool $updateSettings): void
383384
Settings updated of "sf_phpunit__posts".
384385
Settings updated of "sf_phpunit__posts".
385386
Settings updated of "sf_phpunit__posts".
387+
Settings updated of "sf_phpunit__posts".
386388
Creating index sf_phpunit__comments for Meilisearch\Bundle\Tests\Entity\Comment
387389
Creating index sf_phpunit__tags for Meilisearch\Bundle\Tests\Entity\Tag
388390
Creating index sf_phpunit__tags for Meilisearch\Bundle\Tests\Entity\Link
@@ -434,6 +436,7 @@ public function testSearchCreateWithIndices(): void
434436
Settings updated of "sf_phpunit__posts".
435437
Settings updated of "sf_phpunit__posts".
436438
Settings updated of "sf_phpunit__posts".
439+
Settings updated of "sf_phpunit__posts".
437440
Done!
438441

439442
EOD, $createOutput);

Diff for: tests/config/meilisearch.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ meilisearch:
1111
settings:
1212
stopWords: ['the', 'a', 'an']
1313
filterableAttributes: ['title', 'publishedAt']
14+
searchCutoffMs: 1500
1415
typoTolerance:
1516
enabled: true
1617
disableOnAttributes: ['title']

0 commit comments

Comments
 (0)