diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/QueryBuilder.php b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/QueryBuilder.php index 8d8bd87ff22814da5088f7d942480cc2224e6454..f3ebb5ba45ab562a0c4ff7cbd9c02f9a84d01335 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/QueryBuilder.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/QueryBuilder.php @@ -225,12 +225,13 @@ class QueryBuilder implements QueryBuilderInterface $searchString = preg_replace('/"[^"]*"/', 'quoted', $searchString); // Check for field specifiers: - if (preg_match("/[^\s]\:[^\s]/", $searchString)) { + if (preg_match("/[^\s\\\]\:[^\s]/", $searchString)) { return true; } - // Check for parentheses and range operators: - if (strstr($searchString, '(') && strstr($searchString, ')')) { + // Check for unescaped parentheses: + $stripped = str_replace(array('\(', '\)'), '', $searchString); + if (strstr($stripped, '(') && strstr($stripped, ')')) { return true; } $rangeReg = self::SOLR_RANGE_RE;