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

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-1 / +18 lines)
Lines 940-945 sub _clean_search_term { Link Here
940
940
941
    $term = $self->_query_regex_escape_process($term);
941
    $term = $self->_query_regex_escape_process($term);
942
942
943
    # save all regex contents away before escaping brackets:
944
    my @saved_regexes;
945
    my $rgx_i = 0;
946
    while(
947
            $term =~ s@(
948
                (?<!\\)(?:[\\]{2})*/
949
                (?:[^/]+|(?<=\\)(?:[\\]{2})*/)+
950
                (?<!\\)(?:[\\]{2})*/
951
            )$lookahead@"~~XI$rgx_i~~"@ex
952
    ) {
953
        @saved_regexes[$rgx_i++] = $1;
954
    }
955
943
    # Remove unquoted colons that have whitespace on either side of them
956
    # Remove unquoted colons that have whitespace on either side of them
944
    $term =~ s/^[:\s]+//;
957
    $term =~ s/^[:\s]+//;
945
    $term =~ s/[\s:]+$//;
958
    $term =~ s/[\s:]+$//;
Lines 956-961 sub _clean_search_term { Link Here
956
    # screen all brackets with backslash
969
    # screen all brackets with backslash
957
    $term =~ s/([\{\}\[\]])$lookahead/\\$1/g;
970
    $term =~ s/([\{\}\[\]])$lookahead/\\$1/g;
958
971
972
    # restore all regex contents after escaping brackets:
973
    for (my $i = 0; $i < @saved_regexes; $i++) {
974
        $term =~ s/~~XI$i~~/$saved_regexes[$i]/;
975
    }
976
959
    return $term;
977
    return $term;
960
}
978
}
961
979
962
- 

Return to bug 28316