mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-09 12:44:59 +02:00
Fixed regex function for postgres
This commit is contained in:
parent
c58ff5861d
commit
6e9b337b49
5 changed files with 58 additions and 3 deletions
|
@ -113,7 +113,7 @@ class TextConstraint extends AbstractConstraint
|
|||
|
||||
//Regex is only supported on MySQL and needs a special function
|
||||
if ($this->operator === 'REGEX') {
|
||||
$queryBuilder->andWhere(sprintf('REGEXP(%s, :%s) = 1', $this->property, $this->identifier));
|
||||
$queryBuilder->andWhere(sprintf('REGEXP(%s, :%s) = TRUE', $this->property, $this->identifier));
|
||||
$queryBuilder->setParameter($this->identifier, $this->value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ class PartSearchFilter implements FilterInterface
|
|||
//Convert the fields to search to a list of expressions
|
||||
$expressions = array_map(function (string $field): string {
|
||||
if ($this->regex) {
|
||||
return sprintf("REGEXP(%s, :search_query) = 1", $field);
|
||||
return sprintf("REGEXP(%s, :search_query) = TRUE", $field);
|
||||
}
|
||||
|
||||
return sprintf("%s LIKE :search_query", $field);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue