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/Entry.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'app/Models/Entry.php') diff --git a/app/Models/Entry.php b/app/Models/Entry.php index d20f5f2a7..8d20e5412 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -364,10 +364,12 @@ class FreshRSS_Entry extends Minz_Model { $ok = true; foreach ($booleanSearch->searches() as $filter) { if ($filter instanceof FreshRSS_BooleanSearch) { - // BooleanSearches are combined by AND (default) or OR (special case) operator and are recursive + // BooleanSearches are combined by AND (default) or OR or AND NOT (special cases) operators and are recursive if ($filter->operator() === 'OR') { $ok |= $this->matches($filter); - } else { + } elseif ($filter->operator() === 'AND NOT') { + $ok &= !$this->matches($filter); + } else { // AND $ok &= $this->matches($filter); } } elseif ($filter instanceof FreshRSS_Search) { -- cgit v1.2.3