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

SearchCutoffMs setting #331

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->beforeNormalization()
->always()
->then(static function (array $value) {
$stringSettings = ['distinctAttribute', 'proximityPrecision'];
$stringSettings = ['distinctAttribute', 'proximityPrecision', 'searchCutoffMs'];

foreach ($stringSettings as $setting) {
if (isset($value[$setting]) && !is_array($value[$setting])) {
Expand Down
2 changes: 1 addition & 1 deletion src/Services/SettingsUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function update(string $indice, ?int $responseTimeout = null): void

if (isset($value['_service']) && $value['_service'] instanceof SettingsProvider) {
$value = $value['_service']();
} elseif (('distinctAttribute' === $variable || 'proximityPrecision' === $variable) && is_array($value)) {
} elseif (('distinctAttribute' === $variable || 'proximityPrecision' === $variable || 'searchCutoffMs' === $variable) && is_array($value)) {
$value = $value[0] ?? null;
}

Expand Down
3 changes: 3 additions & 0 deletions tests/Integration/CommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function testSearchImportAndClearAndDeleteWithoutIndices(): void
Settings updated of "sf_phpunit__posts".
Settings updated of "sf_phpunit__posts".
Settings updated of "sf_phpunit__posts".
Settings updated of "sf_phpunit__posts".
Importing for index Meilisearch\Bundle\Tests\Entity\Comment
Importing for index Meilisearch\Bundle\Tests\Entity\Tag
Indexed a batch of 6 / 6 Meilisearch\Bundle\Tests\Entity\Tag entities into sf_phpunit__tags index (6 indexed since start)
Expand Down Expand Up @@ -383,6 +384,7 @@ public function testSearchCreateWithoutIndices(bool $updateSettings): void
Settings updated of "sf_phpunit__posts".
Settings updated of "sf_phpunit__posts".
Settings updated of "sf_phpunit__posts".
Settings updated of "sf_phpunit__posts".
Creating index sf_phpunit__comments for Meilisearch\Bundle\Tests\Entity\Comment
Creating index sf_phpunit__tags for Meilisearch\Bundle\Tests\Entity\Tag
Creating index sf_phpunit__tags for Meilisearch\Bundle\Tests\Entity\Link
Expand Down Expand Up @@ -434,6 +436,7 @@ public function testSearchCreateWithIndices(): void
Settings updated of "sf_phpunit__posts".
Settings updated of "sf_phpunit__posts".
Settings updated of "sf_phpunit__posts".
Settings updated of "sf_phpunit__posts".
Done!

EOD, $createOutput);
Expand Down
1 change: 1 addition & 0 deletions tests/config/meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ meilisearch:
settings:
stopWords: ['the', 'a', 'an']
filterableAttributes: ['title', 'publishedAt']
searchCutoffMs: 1500
typoTolerance:
enabled: true
disableOnAttributes: ['title']
Expand Down
Loading