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

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-4 / +4 lines)
Lines 1062-1075 sub _fix_limit_special_cases { Link Here
1062
    foreach my $l (@$limits) {
1062
    foreach my $l (@$limits) {
1063
1063
1064
        # This is set up by opac-search.pl
1064
        # This is set up by opac-search.pl
1065
        if ( $l =~ /^yr,st-numeric,ge=/ ) {
1065
        if ( $l =~ /^yr,st-numeric,ge[=:]/ ) {
1066
            my ( $start, $end ) =
1066
            my ( $start, $end ) =
1067
              ( $l =~ /^yr,st-numeric,ge=(.*) and yr,st-numeric,le=(.*)$/ );
1067
              ( $l =~ /^yr,st-numeric,ge[=:](.*) and yr,st-numeric,le[=:](.*)$/ );
1068
            next unless defined($start) && defined($end);
1068
            next unless defined($start) && defined($end);
1069
            push @new_lim, "date-of-publication:[$start TO $end]";
1069
            push @new_lim, "date-of-publication:[$start TO $end]";
1070
        }
1070
        }
1071
        elsif ( $l =~ /^yr,st-numeric=/ ) {
1071
        elsif ( $l =~ /^yr,st-numeric[=:]/ ) {
1072
            my ($date) = ( $l =~ /^yr,st-numeric=(.*)$/ );
1072
            my ($date) = ( $l =~ /^yr,st-numeric[=:](.*)$/ );
1073
            next unless defined($date);
1073
            next unless defined($date);
1074
            $date = $self->_modify_string_by_type(type => 'st-year', operand => $date);
1074
            $date = $self->_modify_string_by_type(type => 'st-year', operand => $date);
1075
            push @new_lim, "date-of-publication:$date";
1075
            push @new_lim, "date-of-publication:$date";
(-)a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t (-2 / +9 lines)
Lines 215-221 subtest 'build_authorities_query_compat() tests' => sub { Link Here
215
};
215
};
216
216
217
subtest 'build_query tests' => sub {
217
subtest 'build_query tests' => sub {
218
    plan tests => 59;
218
    plan tests => 60;
219
219
220
    my $qb;
220
    my $qb;
221
221
Lines 339-344 subtest 'build_query tests' => sub { Link Here
339
        'Open end year in year range of an st-year search is handled properly'
339
        'Open end year in year range of an st-year search is handled properly'
340
    );
340
    );
341
341
342
    ( undef, $query ) = $qb->build_query_compat( undef, ['2019-'], ['yr,st-year'],
343
        ['yr,st-numeric:-2019','yr,st-numeric:2005','yr,st-numeric:1984-2022'] );
344
    is(
345
        $query->{query}{query_string}{query},
346
        '(date-of-publication:[2019 TO *]) AND (date-of-publication:[* TO 2019]) AND (date-of-publication:2005) AND (date-of-publication:[1984 TO 2022])',
347
        'Limit on year search is handled properly when colon used'
348
    );
349
342
    # Enable auto-truncation
350
    # Enable auto-truncation
343
    t::lib::Mocks::mock_preference( 'QueryAutoTruncate', '1' );
351
    t::lib::Mocks::mock_preference( 'QueryAutoTruncate', '1' );
344
352
345
- 

Return to bug 31076