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

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-2 / +2 lines)
Lines 940-949 sub _clean_search_term { Link Here
940
    }
940
    }
941
941
942
    # Remove unquoted colons that have whitespace on either side of them
942
    # Remove unquoted colons that have whitespace on either side of them
943
    $term =~ s/^:\s*//;
944
    $term =~ s/\s*:+$//;
943
    $term =~ s/(:+)(\s+)$lookahead/$2/g;
945
    $term =~ s/(:+)(\s+)$lookahead/$2/g;
944
    $term =~ s/(\s+)(:+)$lookahead/$1/g;
946
    $term =~ s/(\s+)(:+)$lookahead/$1/g;
945
    $term =~ s/^://;
946
947
    $term = $self->_query_regex_escape_process($term);
947
    $term = $self->_query_regex_escape_process($term);
948
948
949
    return $term;
949
    return $term;
(-)a/t/Koha/SearchEngine/Elasticsearch/QueryBuilder.t (-2 / +7 lines)
Lines 187-193 subtest '_split_query() tests' => sub { Link Here
187
};
187
};
188
188
189
subtest '_clean_search_term() tests' => sub {
189
subtest '_clean_search_term() tests' => sub {
190
    plan tests => 12;
190
    plan tests => 14;
191
191
192
    my $qb;
192
    my $qb;
193
    ok(
193
    ok(
Lines 207-212 subtest '_clean_search_term() tests' => sub { Link Here
207
    $res = $qb->_clean_search_term('"unbalanced "quotes"');
207
    $res = $qb->_clean_search_term('"unbalanced "quotes"');
208
    is($res, ' unbalanced  quotes ', 'unbalanced quotes removed');
208
    is($res, ' unbalanced  quotes ', 'unbalanced quotes removed');
209
209
210
    $res = $qb->_clean_search_term(':test query');
211
    is($res, 'test query', 'colon at the start removed');
212
213
    $res = $qb->_clean_search_term('test query:');
214
    is($res, 'test query', 'colon at the end removed');
215
210
    $res = $qb->_clean_search_term('test : query');
216
    $res = $qb->_clean_search_term('test : query');
211
    is($res, 'test  query', 'dangling colon removed');
217
    is($res, 'test  query', 'dangling colon removed');
212
218
213
- 

Return to bug 28292