diff --git a/app/src/Lib/Match/MatchService.php b/app/src/Lib/Match/MatchService.php index 44d6d1cbd..c5243ba2e 100644 --- a/app/src/Lib/Match/MatchService.php +++ b/app/src/Lib/Match/MatchService.php @@ -515,14 +515,15 @@ protected function search(string $mode, $andclause = $colclause . "=?"; break; case SearchTypeEnum::Mapping: + $qclause = (!$ruleattr->attribute->case_sensitive ? "LOWER(query)" : "query"); $andclause = "(" . $colclause . " IN (SELECT value FROM attribute_mappings WHERE attribute_map_id=" . $ruleattr->attribute->attribute_map_id ." - AND query=LOWER(?)) + AND " . $qclause . "=?) OR " . $colclause . "=?)"; - // We need to copies of $val in the param list - $vals[] = $val; + // We need two copies of $val in the param list + $vals[] = (!$ruleattr->attribute->case_sensitive ? strtolower($val) : $val); break; case SearchTypeEnum::Substring: $andclause = "SUBSTRING("