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

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

Return to bug 23521