From e27eb1ca9198119ea1b0bd79be5f1aead45d615a Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 16 Aug 2022 10:56:07 +0200 Subject: Basic support for negative searches with parentheses (#4503) * Basic support for negative searches with parentheses * `!((author:Alice intitle:hello) OR (author:Bob intitle:world))` * `(author:Alice intitle:hello) !(author:Bob intitle:world)` * `!(S:1 OR S:2)` * Minor documentation / comment * Remove syslog debug line --- tests/app/Models/SearchTest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/app/Models/SearchTest.php b/tests/app/Models/SearchTest.php index 74c1596f6..3fb5a144f 100644 --- a/tests/app/Models/SearchTest.php +++ b/tests/app/Models/SearchTest.php @@ -330,6 +330,16 @@ class SearchTest extends PHPUnit\Framework\TestCase { ' ((e.id IN (SELECT et.id_entry FROM `_entrytag` et, `_tag` t WHERE et.id_tag = t.id AND t.name IN (?)) )) ', ['%tag%','%Hello%','%Alice%','%example%','3','%World%', 'Bleu'] ], + [ + '!((author:Alice intitle:hello) OR (author:Bob intitle:world))', + ' NOT (((e.author LIKE ? AND e.title LIKE ? )) OR ((e.author LIKE ? AND e.title LIKE ? ))) ', + ['%Alice%', '%hello%', '%Bob%', '%world%'], + ], + [ + '(author:Alice intitle:hello) !(author:Bob intitle:world)', + ' ((e.author LIKE ? AND e.title LIKE ? )) AND NOT ((e.author LIKE ? AND e.title LIKE ? )) ', + ['%Alice%', '%hello%', '%Bob%', '%world%'], + ] ]; } } -- cgit v1.2.3