diff options
| author | 2024-09-20 14:01:18 +0200 | |
|---|---|---|
| committer | 2024-09-20 14:01:18 +0200 | |
| commit | 7d0e1b1a848280eb4af98ecf14c39e2fd50020f6 (patch) | |
| tree | d58fade3c7676219f30a1e073161488406d7af37 /tests/app | |
| parent | 469a42d9c3dedaf2817ba6ffec2f0945f83e63c0 (diff) | |
Fix search with double-quote and parenthesis (#6818)
Fix searches like `("test")` with a double-quote preceded by a parenthesis
Diffstat (limited to 'tests/app')
| -rw-r--r-- | tests/app/Models/SearchTest.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/app/Models/SearchTest.php b/tests/app/Models/SearchTest.php index 58eb875e0..3092b43ca 100644 --- a/tests/app/Models/SearchTest.php +++ b/tests/app/Models/SearchTest.php @@ -296,6 +296,7 @@ class SearchTest extends PHPUnit\Framework\TestCase { ['!ab OR -cd', '(!ab) OR (-cd)'], ['ab cd OR ef OR "gh ij"', '(ab cd) OR (ef) OR ("gh ij")'], ['ab (!cd)', 'ab (!cd)'], + ['"ab" (!"cd")', '"ab" (!"cd")'], ]; } @@ -321,6 +322,7 @@ class SearchTest extends PHPUnit\Framework\TestCase { ['(ab (cd OR ef OR (gh))) OR ij', '(ab ((cd) OR (ef) OR (gh))) OR (ij)'], ['(ab (!cd OR ef OR (gh))) OR ij', '(ab ((!cd) OR (ef) OR (gh))) OR (ij)'], ['(ab !(cd OR ef OR !(gh))) OR ij', '(ab !((cd) OR (ef) OR !(gh))) OR (ij)'], + ['"ab" OR (!"cd")', '("ab") OR (!"cd")'], ]; } @@ -440,6 +442,18 @@ class SearchTest extends PHPUnit\Framework\TestCase { 'OR (((e.title LIKE ? OR e.content LIKE ?) )))) OR NOT (((e.title LIKE ? OR e.content LIKE ?) ) OR ((e.title LIKE ? OR e.content LIKE ?) ))', ['%ab%', '%ab%', '%cd%', '%cd%', '%ef%', '%ef%', '%gh%', '%gh%', '%ij%', '%ij%', '%kl%', '%kl%'], ], + [ + '"ab" "cd" ("ef") intitle:"gh" !"ij" -"kl"', + '(((e.title LIKE ? OR e.content LIKE ?) AND (e.title LIKE ? OR e.content LIKE ?) )) AND (((e.title LIKE ? OR e.content LIKE ?) )) ' . + 'AND ((e.title LIKE ? AND e.title NOT LIKE ? AND e.content NOT LIKE ? AND e.title NOT LIKE ? AND e.content NOT LIKE ? ))', + ['%ab%', '%ab%', '%cd%', '%cd%', '%ef%', '%ef%', '%gh%', '%ij%', '%ij%', '%kl%', '%kl%'] + ], + [ + '"ab" "cd" ("ef") intitle:"gh" !"ij" -"kl"', + '(((e.title LIKE ? OR e.content LIKE ?) AND (e.title LIKE ? OR e.content LIKE ?) )) AND (((e.title LIKE ? OR e.content LIKE ?) )) ' . + 'AND ((e.title LIKE ? AND e.title NOT LIKE ? AND e.content NOT LIKE ? AND e.title NOT LIKE ? AND e.content NOT LIKE ? ))', + ['%ab%', '%ab%', '%cd%', '%cd%', '%ef%', '%ef%', '%gh%', '%ij%', '%ij%', '%kl%', '%kl%'] + ], ]; } |
