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

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-7 / +12 lines)
Lines 938-951 sub _clean_search_term { Link Here
938
    if ($count % 2 == 1) {
938
    if ($count % 2 == 1) {
939
        $term = $unquoted;
939
        $term = $unquoted;
940
    }
940
    }
941
942
    # Remove unquoted colons that have whitespace on either side of them
943
    $term =~ s/(:+)(\s+)$lookahead/$2/g;
944
    $term =~ s/(\s+)(:+)$lookahead/$1/g;
945
    $term =~ s/^://;
946
947
    $term = $self->_query_regex_escape_process($term);
941
    $term = $self->_query_regex_escape_process($term);
948
942
943
    # remove leading and trailing colons mixed with optional slashes and spaces
944
    $term =~ s/^([\s\\]*:\s*)+//;
945
    $term =~ s/([\s\\]*:\s*)+$//;
946
    # remove unquoted colons that have whitespace on either side of them
947
    $term =~ s/([\s\\]*:\s*)+(\s+)$lookahead/$2/g;
948
    $term =~ s/(\s+)([\s\\]*:\s*)+$lookahead/$1/g;
949
    # replace with spaces all repeated colons no matter how they surrounded with spaces and slashes
950
    $term =~ s/([\s\\]*:\s*){2,}$lookahead/ /g;
951
    # screen all followups for colons after first colon,
952
    # and correctly ignore unevenly backslashed:
953
    $term =~ s/((?<!\\)(?:[\\]{2})*:[^:\s]+(?<!\\)(?:[\\]{2})*)(?=:)/$1\\/g;
954
949
    return $term;
955
    return $term;
950
}
956
}
951
957
952
- 

Return to bug 28316