mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-20 18:31:33 +00:00
Unterstützung für Projekt- und Baugruppensuche zum QuickSearch-Suggest hinzufügen
This commit is contained in:
parent
4911b5bf24
commit
74513b748d
23 changed files with 519 additions and 50 deletions
|
|
@ -51,4 +51,18 @@ class DeviceRepository extends StructuralDBElementRepository
|
|||
//Prevent user from deleting devices, to not accidentally remove filled devices from old versions
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function autocompleteSearch(string $query, int $max_limits = 50): array
|
||||
{
|
||||
$qb = $this->createQueryBuilder('p');
|
||||
$qb->select('p')
|
||||
->where('ILIKE(p.name, :query) = TRUE');
|
||||
|
||||
$qb->setParameter('query', '%'.$query.'%');
|
||||
|
||||
$qb->setMaxResults($max_limits);
|
||||
$qb->orderBy('NATSORT(p.name)', 'ASC');
|
||||
|
||||
return $qb->getQuery()->getResult();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue