@@ -, +, @@ colons --- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -939,12 +939,17 @@ sub _clean_search_term { $term = $unquoted; } + $term = $self->_query_regex_escape_process($term); + # Remove unquoted colons that have whitespace on either side of them + $term =~ s/^[:\s]+//; + $term =~ s/[\s:]+$//; $term =~ s/(:+)(\s+)$lookahead/$2/g; $term =~ s/(\s+)(:+)$lookahead/$1/g; - $term =~ s/^://; - $term = $self->_query_regex_escape_process($term); + # screen all followups for colons after first colon, + # and correctly ignore unevenly backslashed: + $term =~ s/((?