Fixed regex function for postgres

This commit is contained in:
Jan Böhmer 2024-06-13 23:18:25 +02:00
parent c58ff5861d
commit 6e9b337b49
5 changed files with 58 additions and 3 deletions

View file

@ -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);
}
}

View file

@ -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);