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

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-1 / +7 lines)
Lines 929-935 sub _fix_limit_special_cases { Link Here
929
            push @new_lim, 'onloan:0';
929
            push @new_lim, 'onloan:0';
930
        }
930
        }
931
        else {
931
        else {
932
            push @new_lim, $l;
932
            my ( $field, $term ) = $l =~ /^\s*([\w,-]*?):(.*)/;
933
            if ( defined($field) && defined($term) ) {
934
                push @new_lim, "$field:($term)";
935
            }
936
            else {
937
                push @new_lim, $l;
938
            }
933
        }
939
        }
934
    }
940
    }
935
    return \@new_lim;
941
    return \@new_lim;
(-)a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t (-2 / +15 lines)
Lines 191-197 subtest 'build_authorities_query_compat() tests' => sub { Link Here
191
};
191
};
192
192
193
subtest 'build_query tests' => sub {
193
subtest 'build_query tests' => sub {
194
    plan tests => 40;
194
    plan tests => 42;
195
195
196
    my $qb;
196
    my $qb;
197
197
Lines 436-441 subtest 'build_query tests' => sub { Link Here
436
        '(title:"donald duck")',
436
        '(title:"donald duck")',
437
        "query of specific field is not added AND suppress:0"
437
        "query of specific field is not added AND suppress:0"
438
    );
438
    );
439
440
    ( undef, $query ) = $qb->build_query_compat( ['AND'], ['title:"donald duck"'], undef, ['author:Dillinger Escaplan'] );
441
    is(
442
        $query->{query}{query_string}{query},
443
        '(title:"donald duck") AND author:(Dillinger Escaplan)',
444
        "Simplle query with limit's term in parentheses"
445
    );
446
447
    ( undef, $query ) = $qb->build_query_compat( ['AND'], ['title:"donald duck"'], undef, ['author:Dillinger Escaplan', 'itype:BOOK'] );
448
    is(
449
        $query->{query}{query_string}{query},
450
        '(title:"donald duck") AND (author:(Dillinger Escaplan)) AND (itype:(BOOK))',
451
        "Simplle query with each limit's term in parentheses"
452
    );
439
    is($query_cgi, 'idx=&q=title%3A%22donald%20duck%22', 'query cgi');
453
    is($query_cgi, 'idx=&q=title%3A%22donald%20duck%22', 'query cgi');
440
    is($query_desc, 'title:"donald duck"', 'query desc ok');
454
    is($query_desc, 'title:"donald duck"', 'query desc ok');
441
};
455
};
442
- 

Return to bug 23521