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 609-614 if ( $indexing_mode eq 'dom' ) { Link Here
609
    ($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0);
609
    ($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0);
610
    is($results_hashref->{biblioserver}->{hits}, undef, "Search for 'pressed' returns no matches when stemming is off");
610
    is($results_hashref->{biblioserver}->{hits}, undef, "Search for 'pressed' returns no matches when stemming is off");
611
611
612
    ( $error, $query, $simple_query, $query_cgi,
613
    $query_desc, $limit, $limit_cgi, $limit_desc,
614
    $query_type ) = buildQuery([], [ 'ccl=an:42' ], [], ['available'], [], 0, 'en');
615
    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' );
616
    is( $query_desc, 'an:42', 'buildQuery should remove the available part from the query' );
617
612
    # Let's see what happens when we pass bad data into these routines.
618
    # Let's see what happens when we pass bad data into these routines.
613
    # We have to catch warnings since we're not very good about returning errors.
619
    # We have to catch warnings since we're not very good about returning errors.
614
620
Lines 956-967 sub run_unimarc_search_tests { Link Here
956
}
962
}
957
963
958
subtest 'MARC21 + GRS-1' => sub {
964
subtest 'MARC21 + GRS-1' => sub {
959
    plan tests => 107;
965
    plan tests => 109;
960
    run_marc21_search_tests('grs1');
966
    run_marc21_search_tests('grs1');
961
};
967
};
962
968
963
subtest 'MARC21 + DOM' => sub {
969
subtest 'MARC21 + DOM' => sub {
964
    plan tests => 107;
970
    plan tests => 109;
965
    run_marc21_search_tests('dom');
971
    run_marc21_search_tests('dom');
966
};
972
};
967
973
968
- 

Return to bug 17278