my $display_library_facets = C4::Context->preference('DisplayLibraryFacets');
if ( $display_library_facets eq 'both'
or $display_library_facets eq 'home' ) {
- $res->{aggregations}{homebranch} = { terms => { field => "homebranch__facet" } };
+ $res->{aggregations}{homebranch} = { terms => { field => "homebranch__facet", size => $size } };
}
if ( $display_library_facets eq 'both'
or $display_library_facets eq 'holding' ) {
- $res->{aggregations}{holdingbranch} = { terms => { field => "holdingbranch__facet" } };
+ $res->{aggregations}{holdingbranch} = { terms => { field => "holdingbranch__facet", size => $size } };
}
return $res;
}
};
subtest 'build_query tests' => sub {
- plan tests => 50;
+ plan tests => 51;
my $qb;
);
t::lib::Mocks::mock_preference('FacetMaxCount','37');
+ t::lib::Mocks::mock_preference('DisplayLibraryFacets','both');
$query = $qb->build_query('test', %options);
ok( defined $query->{aggregations}{ccode}{terms}{size},'we need to ask for a size or we get only 5 facet' );
is( $query->{aggregations}{ccode}{terms}{size}, 37,'we ask for the size as defined by the syspref FacetMaxCount');
+ is( $query->{aggregations}{homebranch}{terms}{size}, 37,'we ask for the size as defined by the syspref FacetMaxCount fir homebranch');
t::lib::Mocks::mock_preference('DisplayLibraryFacets','both');
$query = $qb->build_query();