From 5d53a63c30a7327f782a9cedffb7c8dad63480c8 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Thu, 7 Feb 2019 15:51:10 -0500 Subject: [PATCH] Add support for advanced exclusion filters. --- module/VuFind/src/VuFind/Search/Base/Params.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/module/VuFind/src/VuFind/Search/Base/Params.php b/module/VuFind/src/VuFind/Search/Base/Params.php index d035b0ff116..cb41f3086ad 100644 --- a/module/VuFind/src/VuFind/Search/Base/Params.php +++ b/module/VuFind/src/VuFind/Search/Base/Params.php @@ -805,10 +805,11 @@ class Params /** * Detects if a filter is advanced (true) or simple (false). An advanced - * filter is currently defined as one surrounded by parentheses, while a - * simple filter is of the form field:value. Advanced filters are used to - * express more complex queries, such as combining multiple values from - * multiple fields using boolean operators. + * filter is currently defined as one surrounded by parentheses (possibly + * with a leading exclusion operator), while a simple filter is of the form + * field:value. Advanced filters are used to express more complex queries, + * such as combining multiple values from multiple fields using boolean + * operators. * * @param string $filter A filter string * @@ -816,7 +817,7 @@ class Params */ public function isAdvancedFilter($filter) { - if (substr($filter, 0, 1) == '(') { + if (substr($filter, 0, 1) == '(' || substr($filter, 0, 2) == '-(') { return true; } return false; -- GitLab