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

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-1 / +7 lines)
Lines 881-887 sub _fix_limit_special_cases { Link Here
881
            push @new_lim, 'onloan:0';
881
            push @new_lim, 'onloan:0';
882
        }
882
        }
883
        else {
883
        else {
884
            push @new_lim, $l;
884
            my ( $field, $term ) = $l =~ /^\s*([\w,-]*?):(.*)/;
885
            if ( defined($field) && defined($term) ) {
886
                push @new_lim, "$field:($term)";
887
            }
888
            else {
889
                push @new_lim, $l;
890
            }
885
        }
891
        }
886
    }
892
    }
887
    return \@new_lim;
893
    return \@new_lim;
(-)a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t (-2 / +15 lines)
Lines 169-175 subtest 'build_authorities_query_compat() tests' => sub { Link Here
169
};
169
};
170
170
171
subtest 'build_query tests' => sub {
171
subtest 'build_query tests' => sub {
172
    plan tests => 40;
172
    plan tests => 42;
173
173
174
    my $qb;
174
    my $qb;
175
175
Lines 414-419 subtest 'build_query tests' => sub { Link Here
414
        '(title:"donald duck")',
414
        '(title:"donald duck")',
415
        "query of specific field is not added AND suppress:0"
415
        "query of specific field is not added AND suppress:0"
416
    );
416
    );
417
418
    ( undef, $query ) = $qb->build_query_compat( ['AND'], ['title:"donald duck"'], undef, ['author:Dillinger Escaplan'] );
419
    is(
420
        $query->{query}{query_string}{query},
421
        '(title:"donald duck") AND author:(Dillinger Escaplan)',
422
        "Simplle query with limit's term in parentheses"
423
    );
424
425
    ( undef, $query ) = $qb->build_query_compat( ['AND'], ['title:"donald duck"'], undef, ['author:Dillinger Escaplan', 'itype:BOOK'] );
426
    is(
427
        $query->{query}{query_string}{query},
428
        '(title:"donald duck") AND (author:(Dillinger Escaplan)) AND (itype:(BOOK))',
429
        "Simplle query with each limit's term in parentheses"
430
    );
417
    is($query_cgi, 'idx=&q=title%3A%22donald%20duck%22', 'query cgi');
431
    is($query_cgi, 'idx=&q=title%3A%22donald%20duck%22', 'query cgi');
418
    is($query_desc, 'title:"donald duck"', 'query desc ok');
432
    is($query_desc, 'title:"donald duck"', 'query desc ok');
419
};
433
};
420
- 

Return to bug 23521