From 4d153eeaf85905e8402cc8d175f202967d909020 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 21 Mar 2022 12:51:03 +0100 Subject: Fix some search expressions (#4277) * Fix some search expressions * Fix decoding bug when using quotes to search free text containing some spaces such as `"ab cd"` * Fix use of `-` wrongly triggering a negative search in e.g. `ab-cd` * Fix edge cases * A couple of tests --- app/Models/BooleanSearch.php | 1 + 1 file changed, 1 insertion(+) (limited to 'app/Models/BooleanSearch.php') diff --git a/app/Models/BooleanSearch.php b/app/Models/BooleanSearch.php index 88eeea73c..e2f99d524 100644 --- a/app/Models/BooleanSearch.php +++ b/app/Models/BooleanSearch.php @@ -16,6 +16,7 @@ class FreshRSS_BooleanSearch { $this->raw_input = $input; $input = preg_replace('/:"(.*?)"/', ':"\1"', $input); + $input = preg_replace('/(?<=[\s!-]|^)"(.*?)"/', '"\1"', $input); $splits = preg_split('/\b(OR)\b/i', $input, -1, PREG_SPLIT_DELIM_CAPTURE); $segment = ''; -- cgit v1.2.3