mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-08 01:14:34 +02: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
|
@ -75,8 +75,8 @@ class AttachmentRepository extends DBElementRepository
|
|||
{
|
||||
$qb = $this->createQueryBuilder('attachment');
|
||||
$qb->select('COUNT(attachment)')
|
||||
->where('attachment.path LIKE :http')
|
||||
->orWhere('attachment.path LIKE :https');
|
||||
->where('ILIKE(attachment.path, :http) = TRUE')
|
||||
->orWhere('ILIKE(attachment.path, :https) = TRUE');
|
||||
$qb->setParameter('http', 'http://%');
|
||||
$qb->setParameter('https', 'https://%');
|
||||
$query = $qb->getQuery();
|
||||
|
|
|
@ -44,7 +44,7 @@ class ParameterRepository extends DBElementRepository
|
|||
->select('parameter.name')
|
||||
->addSelect('parameter.symbol')
|
||||
->addSelect('parameter.unit')
|
||||
->where('parameter.name LIKE :name');
|
||||
->where('ILIKE(parameter.name, :name) = TRUE');
|
||||
if ($exact) {
|
||||
$qb->setParameter('name', $name);
|
||||
} else {
|
||||
|
|
|
@ -81,10 +81,10 @@ class PartRepository extends NamedDBElementRepository
|
|||
->leftJoin('part.category', 'category')
|
||||
->leftJoin('part.footprint', 'footprint')
|
||||
|
||||
->where('part.name LIKE :query')
|
||||
->orWhere('part.description LIKE :query')
|
||||
->orWhere('category.name LIKE :query')
|
||||
->orWhere('footprint.name LIKE :query')
|
||||
->where('ILIKE(part.name, :query) = TRUE')
|
||||
->orWhere('ILIKE(part.description, :query) = TRUE')
|
||||
->orWhere('ILIKE(category.name, :query) = TRUE')
|
||||
->orWhere('ILIKE(footprint.name, :query) = TRUE')
|
||||
;
|
||||
|
||||
$qb->setParameter('query', '%'.$query.'%');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue