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

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-5 / +2 lines)
Lines 995-1003 The argument should be an arrayref, and it'll return an arrayref. Link Here
995
sub _fix_limit_special_cases {
995
sub _fix_limit_special_cases {
996
    my ( $self, $limits ) = @_;
996
    my ( $self, $limits ) = @_;
997
997
998
    # yr is usually an alias of a search field
999
    my $yrfield = ( exists $index_field_convert{'yr'} ) ? $index_field_convert{'yr'} : 'yr';
1000
1001
    my @new_lim;
998
    my @new_lim;
1002
    foreach my $l (@$limits) {
999
    foreach my $l (@$limits) {
1003
1000
Lines 1006-1018 sub _fix_limit_special_cases { Link Here
1006
            my ( $start, $end ) =
1003
            my ( $start, $end ) =
1007
              ( $l =~ /^yr,st-numeric,ge=(.*) and yr,st-numeric,le=(.*)$/ );
1004
              ( $l =~ /^yr,st-numeric,ge=(.*) and yr,st-numeric,le=(.*)$/ );
1008
            next unless defined($start) && defined($end);
1005
            next unless defined($start) && defined($end);
1009
            push @new_lim, "$yrfield:[$start TO $end]";
1006
            push @new_lim, "date-of-publication:[$start TO $end]";
1010
        }
1007
        }
1011
        elsif ( $l =~ /^yr,st-numeric=/ ) {
1008
        elsif ( $l =~ /^yr,st-numeric=/ ) {
1012
            my ($date) = ( $l =~ /^yr,st-numeric=(.*)$/ );
1009
            my ($date) = ( $l =~ /^yr,st-numeric=(.*)$/ );
1013
            next unless defined($date);
1010
            next unless defined($date);
1014
            $date = $self->_modify_string_by_type(type => 'st-year', operand => $date);
1011
            $date = $self->_modify_string_by_type(type => 'st-year', operand => $date);
1015
            push @new_lim, "$yrfield:$date";
1012
            push @new_lim, "date-of-publication:$date";
1016
        }
1013
        }
1017
        elsif ( $l =~ /^available$/ ) {
1014
        elsif ( $l =~ /^available$/ ) {
1018
            push @new_lim, 'onloan:false';
1015
            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