mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-09 12:39:30 +00:00
Added a custom function to make PostgresSQL searches case insensitive
This is required only for postgres as every other database is case invariant by default. But to achieve a portable way, we implement it via a custom DQL function. This fixes issue #784
This commit is contained in:
parent
b1ba26e0b9
commit
e223078af9
11 changed files with 94 additions and 22 deletions
|
|
@ -50,7 +50,7 @@ final class LikeFilter extends AbstractFilter
|
|||
}
|
||||
$parameterName = $queryNameGenerator->generateParameterName($property); // Generate a unique parameter name to avoid collisions with other filters
|
||||
$queryBuilder
|
||||
->andWhere(sprintf('o.%s LIKE :%s', $property, $parameterName))
|
||||
->andWhere(sprintf('ILIKE(o.%s, :%s) = TRUE', $property, $parameterName))
|
||||
->setParameter($parameterName, $value);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,10 +61,10 @@ final class TagFilter extends AbstractFilter
|
|||
$expr = $queryBuilder->expr();
|
||||
|
||||
$tmp = $expr->orX(
|
||||
$expr->like('o.'.$property, ':' . $tag_identifier_prefix . '_1'),
|
||||
$expr->like('o.'.$property, ':' . $tag_identifier_prefix . '_2'),
|
||||
$expr->like('o.'.$property, ':' . $tag_identifier_prefix . '_3'),
|
||||
$expr->eq('o.'.$property, ':' . $tag_identifier_prefix . '_4'),
|
||||
'ILIKE(o.'.$property.', :' . $tag_identifier_prefix . '_1) = TRUE',
|
||||
'ILIKE(o.'.$property.', :' . $tag_identifier_prefix . '_2) = TRUE',
|
||||
'ILIKE(o.'.$property.', :' . $tag_identifier_prefix . '_3) = TRUE',
|
||||
'ILIKE(o.'.$property.', :' . $tag_identifier_prefix . '_4) = TRUE',
|
||||
);
|
||||
|
||||
$queryBuilder->andWhere($tmp);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue