-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Description
Postgres is case sensitive in queries by default, whereas MySQL is not. So if you're using Postgres as your database for Sylius and you search something in an autocomplete field (products or taxons for example) then it only finds results matching the exact casing you've used in your search.
This could be fixed by adding lower() functions in Sylius\Bundle\AdminBundle\Form\Type\TranslatableAutocompleteType.
Maybe you would want this as a configuration option; I'm not sure what the performance impact would be on large databases with MySQL for example.
Example
In src/Sylius/Bundle/AdminBundle/Form/Type/TranslatableAutocompleteType.php:
<?php
...
final class TranslatableAutocompleteType extends AbstractType
{
...
private static function getComparisons(Expr $expr, array $fields): iterable
{
foreach ($fields as $field) {
yield $expr->like($expr->lower($field), 'LOWER(:query)');
}
}
}Reactions are currently unavailable