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

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

Return to bug 28316