Update AdvancedSearchQueryTerm.php

Applied Amy's fix for "is not" for exact match with double quotation
This commit is contained in:
Kyle Huynh 2023-03-14 17:09:41 -04:00 committed by GitHub
parent 6b75e99407
commit e698a7c6c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -295,14 +295,13 @@ class AdvancedSearchQueryTerm {
// Case 1: if keyword contains one word or a phrase // Case 1: if keyword contains one word or a phrase
if(strpos(trim($value), ' ') !== false) { if(strpos(trim($value), ' ') !== false) {
// phrase
// add Or for the search case "scarborough bulletin" show no results // add Or for the search case "scarborough bulletin" show no results
$isNot = $this->getInclude() ? "" : "!";
if (substr_count($value, '\"') == 2) { if (substr_count($value, '\"') == 2) {
$value = str_replace('\"', "", trim($value)); $value = str_replace('\"', "", trim($value));
return $value; return $isNot . $value;
} }
else { else {
$isNot = $this->getInclude() ? "" : "!";
return $isNot . "(" .$value . " OR " . str_replace('"', "", trim($value)) . ")"; return $isNot . "(" .$value . " OR " . str_replace('"', "", trim($value)) . ")";
} }
} }