View | Details | Raw Unified | Return to bug 28884
Collapse All | Expand All

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-3 / +2 lines)
Lines 1033-1045 sub _query_regex_escape_process { Link Here
1033
            # replaced with a more general parser solution
1033
            # replaced with a more general parser solution
1034
            # so that this function is ever only provided with unquoted
1034
            # so that this function is ever only provided with unquoted
1035
            # query parts
1035
            # query parts
1036
            $query =~ s@(?:(?<!\\)((?:[\\]{2})*)(?=/))(?![^"]*"(?:[^"]*"[^"]*")*[^"]*$)@\\$1@g;
1036
            $query =~ s@(?:(?<!\\)((?:[\\]{2})*)(?=[/\?]))(?![^"]*"(?:[^"]*"[^"]*")*[^"]*$)@\\$1@g;
1037
        }
1037
        }
1038
        elsif($regex_escape_options eq 'unescape_escaped') {
1038
        elsif($regex_escape_options eq 'unescape_escaped') {
1039
            # Will unescape escaped slashes (\/) and escape
1039
            # Will unescape escaped slashes (\/) and escape
1040
            # unescaped slashes (/) while preserving slashes within quotes
1040
            # unescaped slashes (/) while preserving slashes within quotes
1041
            # The same limitatations as above apply for handling of quotes
1041
            # The same limitatations as above apply for handling of quotes
1042
            $query =~ s@(?:(?<!\\)(?:((?:[\\]{2})*[\\])|((?:[\\]{2})*))(?=/))(?![^"]*"(?:[^"]*"[^"]*")*[^"]*$)@($1 ? substr($1, 0, -1) : ($2 . "\\"))@ge;
1042
            $query =~ s@(?:(?<!\\)(?:((?:[\\]{2})*[\\])|((?:[\\]{2})*))(?=[/\?]))(?![^"]*"(?:[^"]*"[^"]*")*[^"]*$)@($1 ? substr($1, 0, -1) : ($2 . "\\"))@ge;
1043
        }
1043
        }
1044
    }
1044
    }
1045
    return $query;
1045
    return $query;
1046
- 

Return to bug 28884