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

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-1 / +1 lines)
Lines 970-976 sub _fix_limit_special_cases { Link Here
970
        else {
970
        else {
971
            my ( $field, $term ) = $l =~ /^\s*([\w,-]*?):(.*)/;
971
            my ( $field, $term ) = $l =~ /^\s*([\w,-]*?):(.*)/;
972
            if ( defined($field) && defined($term) ) {
972
            if ( defined($field) && defined($term) ) {
973
                push @new_lim, "$field:($term)";
973
                push @new_lim, "$field:(\"$term\")";
974
            }
974
            }
975
            else {
975
            else {
976
                push @new_lim, $l;
976
                push @new_lim, $l;
(-)a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t (-5 / +4 lines)
Lines 441-455 subtest 'build_query tests' => sub { Link Here
441
    ( undef, $query ) = $qb->build_query_compat( ['AND'], ['title:"donald duck"'], undef, ['author:Dillinger Escaplan'] );
441
    ( undef, $query ) = $qb->build_query_compat( ['AND'], ['title:"donald duck"'], undef, ['author:Dillinger Escaplan'] );
442
    is(
442
    is(
443
        $query->{query}{query_string}{query},
443
        $query->{query}{query_string}{query},
444
        '(title:"donald duck") AND author:(Dillinger Escaplan)',
444
        '(title:"donald duck") AND author:("Dillinger Escaplan")',
445
        "Simplle query with limit's term in parentheses"
445
        "Simple query with limit term quoted in parentheses"
446
    );
446
    );
447
447
448
    ( undef, $query ) = $qb->build_query_compat( ['AND'], ['title:"donald duck"'], undef, ['author:Dillinger Escaplan', 'itype:BOOK'] );
448
    ( undef, $query ) = $qb->build_query_compat( ['AND'], ['title:"donald duck"'], undef, ['author:Dillinger Escaplan', 'itype:BOOK'] );
449
    is(
449
    is(
450
        $query->{query}{query_string}{query},
450
        $query->{query}{query_string}{query},
451
        '(title:"donald duck") AND (author:(Dillinger Escaplan)) AND (itype:(BOOK))',
451
        '(title:"donald duck") AND (author:("Dillinger Escaplan")) AND (itype:("BOOK"))',
452
        "Simplle query with each limit's term in parentheses"
452
        "Simple query with each limit's term quoted in parentheses"
453
    );
453
    );
454
    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');
455
    is($query_desc, 'title:"donald duck"', 'query desc ok');
455
    is($query_desc, 'title:"donald duck"', 'query desc ok');
456
- 

Return to bug 23521