diff options
| author | 2022-11-23 22:41:00 +0100 | |
|---|---|---|
| committer | 2022-11-23 22:41:00 +0100 | |
| commit | aa07582419998cfa82465c28559f2fa1bba15ee3 (patch) | |
| tree | 5a9eeb8e5723d33d0a0efd6868049ae8c5b22d2d /tests/app/Models | |
| parent | be79c5a8e7dd74b839044d53e50046091674e204 (diff) | |
Better restrict tag search (#4882)
* Better restrict tag search
#fix https://github.com/FreshRSS/FreshRSS/issues/4877
Search only on full tag names and not on parts of tag names
* Better whitespace handling
Diffstat (limited to 'tests/app/Models')
| -rw-r--r-- | tests/app/Models/SearchTest.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/app/Models/SearchTest.php b/tests/app/Models/SearchTest.php index a2832c710..fe686e7ba 100644 --- a/tests/app/Models/SearchTest.php +++ b/tests/app/Models/SearchTest.php @@ -318,17 +318,17 @@ class SearchTest extends PHPUnit\Framework\TestCase { ], [ '#tag Hello OR (author:Alice inurl:example) OR (f:3 intitle:World) OR L:12', - ' ((e.tags LIKE ? AND (e.title LIKE ? OR e.content LIKE ?) )) OR ((e.author LIKE ? AND e.link LIKE ? )) OR' . + " ((TRIM(e.tags) || ' #' LIKE ? AND (e.title LIKE ? OR e.content LIKE ?) )) OR ((e.author LIKE ? AND e.link LIKE ? )) OR" . ' ((e.id_feed IN (?) AND e.title LIKE ? )) OR ((e.id IN (SELECT et.id_entry FROM `_entrytag` et WHERE et.id_tag IN (?)) )) ', - ['%tag%','%Hello%', '%Hello%', '%Alice%', '%example%', '3', '%World%', '12'] + ['%tag #%','%Hello%', '%Hello%', '%Alice%', '%example%', '3', '%World%', '12'] ], [ '#tag Hello (author:Alice inurl:example) (f:3 intitle:World) label:Bleu', - ' ((e.tags LIKE ? AND (e.title LIKE ? OR e.content LIKE ?) )) AND' . + " ((TRIM(e.tags) || ' #' LIKE ? AND (e.title LIKE ? OR e.content LIKE ?) )) AND" . ' ((e.author LIKE ? AND e.link LIKE ? )) AND' . ' ((e.id_feed IN (?) AND e.title LIKE ? )) AND' . ' ((e.id IN (SELECT et.id_entry FROM `_entrytag` et, `_tag` t WHERE et.id_tag = t.id AND t.name IN (?)) )) ', - ['%tag%', '%Hello%', '%Hello%', '%Alice%', '%example%', '3', '%World%', 'Bleu'] + ['%tag #%', '%Hello%', '%Hello%', '%Alice%', '%example%', '3', '%World%', 'Bleu'] ], [ '!((author:Alice intitle:hello) OR (author:Bob intitle:world))', |
