Skip to content
Snippets Groups Projects
Commit e6423f1f authored by Demian Katz's avatar Demian Katz
Browse files

Resolving VUFIND-709 (Issue with searches followed by question marks).

parent 2593d5c7
No related merge requests found
...@@ -374,11 +374,16 @@ class QueryBuilder ...@@ -374,11 +374,16 @@ class QueryBuilder
$string = '[* TO *]'; $string = '[* TO *]';
} }
// If the query ends in a question mark, the user may not really intend to // If the query ends in a non-escaped question mark, the user may not really
// use the question mark as a wildcard -- let's account for that possibility // intend to use the question mark as a wildcard -- let's account for that
if (substr($string, -1) == '?') { // possibility
$string = "({$string}) OR (" . substr($string, 0, strlen($string) - 1) if (substr($query, -1) == '?' && substr($query, -2) != '\?') {
. ")"; // Make sure all question marks are properly escaped (first unescape
// any that are already escaped to prevent double-escapes, then escape
// all of them):
$strippedQuery
= str_replace('?', '\?', str_replace('\?', '?', $query));
$query = "({$query}) OR (" . $strippedQuery . ")";
} }
return $handler return $handler
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment