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

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-5 / +2 lines)
Lines 994-1002 The argument should be an arrayref, and it'll return an arrayref. Link Here
994
sub _fix_limit_special_cases {
994
sub _fix_limit_special_cases {
995
    my ( $self, $limits ) = @_;
995
    my ( $self, $limits ) = @_;
996
996
997
    # yr is usually an alias of a search field
998
    my $yrfield = ( exists $index_field_convert{'yr'} ) ? $index_field_convert{'yr'} : 'yr';
999
1000
    my @new_lim;
997
    my @new_lim;
1001
    foreach my $l (@$limits) {
998
    foreach my $l (@$limits) {
1002
999
Lines 1005-1017 sub _fix_limit_special_cases { Link Here
1005
            my ( $start, $end ) =
1002
            my ( $start, $end ) =
1006
              ( $l =~ /^yr,st-numeric,ge=(.*) and yr,st-numeric,le=(.*)$/ );
1003
              ( $l =~ /^yr,st-numeric,ge=(.*) and yr,st-numeric,le=(.*)$/ );
1007
            next unless defined($start) && defined($end);
1004
            next unless defined($start) && defined($end);
1008
            push @new_lim, "$yrfield:[$start TO $end]";
1005
            push @new_lim, "date-of-publication:[$start TO $end]";
1009
        }
1006
        }
1010
        elsif ( $l =~ /^yr,st-numeric=/ ) {
1007
        elsif ( $l =~ /^yr,st-numeric=/ ) {
1011
            my ($date) = ( $l =~ /^yr,st-numeric=(.*)$/ );
1008
            my ($date) = ( $l =~ /^yr,st-numeric=(.*)$/ );
1012
            next unless defined($date);
1009
            next unless defined($date);
1013
            $date = $self->_modify_string_by_type(type => 'st-year', operand => $date);
1010
            $date = $self->_modify_string_by_type(type => 'st-year', operand => $date);
1014
            push @new_lim, "$yrfield:$date";
1011
            push @new_lim, "date-of-publication:$date";
1015
        }
1012
        }
1016
        elsif ( $l =~ /^available$/ ) {
1013
        elsif ( $l =~ /^available$/ ) {
1017
            push @new_lim, 'onloan:false';
1014
            push @new_lim, 'onloan:false';
(-)a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t (-2 / +1 lines)
Lines 337-343 subtest 'build_query tests' => sub { Link Here
337
    ( undef, $query ) = $qb->build_query_compat( undef, ['2019-'], ['yr,st-year'], ['yr,st-numeric=-2019'] );
337
    ( undef, $query ) = $qb->build_query_compat( undef, ['2019-'], ['yr,st-year'], ['yr,st-numeric=-2019'] );
338
    is(
338
    is(
339
        $query->{query}{query_string}{query},
339
        $query->{query}{query_string}{query},
340
        '(date-of-publication:[2019 TO *]) AND copydate:[* TO 2019]',
340
        '(date-of-publication:[2019 TO *]) AND date-of-publication:[* TO 2019]',
341
        'Open end year in year range of an st-year search is handled properly'
341
        'Open end year in year range of an st-year search is handled properly'
342
    );
342
    );
343
343
344
- 

Return to bug 22801