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

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

Return to bug 28316