diff options
Diffstat (limited to 'app/Models/EntryDAO.php')
| -rw-r--r-- | app/Models/EntryDAO.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index b63515223..cda51e5b4 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -10,6 +10,10 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { return true; } + protected static function sqlConcat($s1, $s2) { + return 'CONCAT(' . $s1 . ',' . $s2 . ')'; //MySQL + } + public static function sqlHexDecode(string $x): string { return 'unhex(' . $x . ')'; } @@ -943,8 +947,8 @@ SQL; } if ($filter->getTags()) { foreach ($filter->getTags() as $tag) { - $sub_search .= 'AND ' . $alias . 'tags LIKE ? '; - $values[] = "%{$tag}%"; + $sub_search .= 'AND ' . static::sqlConcat('TRIM(' . $alias . 'tags) ', " ' #'") . ' LIKE ? '; + $values[] = "%{$tag} #%"; } } if ($filter->getInurl()) { @@ -968,8 +972,8 @@ SQL; } if ($filter->getNotTags()) { foreach ($filter->getNotTags() as $tag) { - $sub_search .= 'AND ' . $alias . 'tags NOT LIKE ? '; - $values[] = "%{$tag}%"; + $sub_search .= 'AND ' . static::sqlConcat('TRIM(' . $alias . 'tags) ', " ' #'") . ' NOT LIKE ? '; + $values[] = "%{$tag} #%"; } } if ($filter->getNotInurl()) { |
