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 --- app/Models/EntryDAO.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app/Models/EntryDAO.php') diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index d69702c60..02552affe 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -770,6 +770,9 @@ SQL; if ($filterSearch !== '') { if ($search !== '') { $search .= $filter->operator(); + } elseif ($filter->operator() === 'AND NOT') { + // Special case if we start with a negation (there is already the default AND before) + $search .= ' NOT'; } $search .= ' (' . $filterSearch . ') '; $values = array_merge($values, $filterValues); -- cgit v1.2.3