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

(-)a/C4/Search.pm (-2 / +7 lines)
Lines 1476-1485 sub buildQuery { Link Here
1476
        # This is needed otherwise ccl= and &limit won't work together, and
1476
        # This is needed otherwise ccl= and &limit won't work together, and
1477
        # this happens when selecting a subject on the opac-detail page
1477
        # this happens when selecting a subject on the opac-detail page
1478
        @limits = grep {!/^$/} @limits;
1478
        @limits = grep {!/^$/} @limits;
1479
        my $original_q = $q; # without available part
1479
        if ( @limits ) {
1480
        if ( @limits ) {
1480
            $q .= ' and '.join(' and ', @limits);
1481
            if ( grep { /^available$/ } @limits ) {
1482
                $q .= q| and ( ( allrecords,AlwaysMatches:'' not onloan,AlwaysMatches:'') and (lost,st-numeric=0) )|;
1483
                delete $limits['available'];
1484
            }
1485
            $q .= ' and '.join(' and ', @limits) if @limits;
1481
        }
1486
        }
1482
        return ( undef, $q, $q, "q=ccl=".uri_escape_utf8($q), $q, '', '', '', 'ccl' );
1487
        return ( undef, $q, $q, "q=ccl=".uri_escape_utf8($q), $original_q, '', '', '', 'ccl' );
1483
    }
1488
    }
1484
    if ( $query =~ /^cql=/ ) {
1489
    if ( $query =~ /^cql=/ ) {
1485
        return ( undef, $', $', "q=cql=".uri_escape_utf8($'), $', '', '', '', 'cql' );
1490
        return ( undef, $', $', "q=cql=".uri_escape_utf8($'), $', '', '', '', 'cql' );
(-)a/t/db_dependent/Search.t (-3 / +8 lines)
Lines 603-608 if ( $indexing_mode eq 'dom' ) { Link Here
603
    ($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0);
603
    ($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0);
604
    is($results_hashref->{biblioserver}->{hits}, undef, "Search for 'pressed' returns no matches when stemming is off");
604
    is($results_hashref->{biblioserver}->{hits}, undef, "Search for 'pressed' returns no matches when stemming is off");
605
605
606
    ( $error, $query, $simple_query, $query_cgi,
607
    $query_desc, $limit, $limit_cgi, $limit_desc,
608
    $query_type ) = buildQuery([], [ 'ccl=an:42' ], [], ['available'], [], 0, 'en');
609
    is( $query, 'an:42 and ( ( allrecords,AlwaysMatches:'' not onloan,AlwaysMatches:'') and (lost,st-numeric=0) )', 'buildQuery should add the available part to the query if requested with ccl' );
610
    is( $query_desc, 'an:42', 'buildQuery should remove the available part from the query' );
611
606
    # Let's see what happens when we pass bad data into these routines.
612
    # Let's see what happens when we pass bad data into these routines.
607
    # We have to catch warnings since we're not very good about returning errors.
613
    # We have to catch warnings since we're not very good about returning errors.
608
614
Lines 948-959 sub run_unimarc_search_tests { Link Here
948
}
954
}
949
955
950
subtest 'MARC21 + GRS-1' => sub {
956
subtest 'MARC21 + GRS-1' => sub {
951
    plan tests => 107;
957
    plan tests => 109;
952
    run_marc21_search_tests('grs1');
958
    run_marc21_search_tests('grs1');
953
};
959
};
954
960
955
subtest 'MARC21 + DOM' => sub {
961
subtest 'MARC21 + DOM' => sub {
956
    plan tests => 107;
962
    plan tests => 109;
957
    run_marc21_search_tests('dom');
963
    run_marc21_search_tests('dom');
958
};
964
};
959
965
960
- 

Return to bug 17278