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

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-2 / +2 lines)
Lines 132-142 sub build_query { Link Here
132
    my $display_library_facets = C4::Context->preference('DisplayLibraryFacets');
132
    my $display_library_facets = C4::Context->preference('DisplayLibraryFacets');
133
    if (   $display_library_facets eq 'both'
133
    if (   $display_library_facets eq 'both'
134
        or $display_library_facets eq 'home' ) {
134
        or $display_library_facets eq 'home' ) {
135
        $res->{aggregations}{homebranch} = { terms => { field => "homebranch__facet" } };
135
        $res->{aggregations}{homebranch} = { terms => { field => "homebranch__facet", size => $size } };
136
    }
136
    }
137
    if (   $display_library_facets eq 'both'
137
    if (   $display_library_facets eq 'both'
138
        or $display_library_facets eq 'holding' ) {
138
        or $display_library_facets eq 'holding' ) {
139
        $res->{aggregations}{holdingbranch} = { terms => { field => "holdingbranch__facet" } };
139
        $res->{aggregations}{holdingbranch} = { terms => { field => "holdingbranch__facet", size => $size } };
140
    }
140
    }
141
    return $res;
141
    return $res;
142
}
142
}
(-)a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t (-2 / +3 lines)
Lines 216-222 subtest 'build_authorities_query_compat() tests' => sub { Link Here
216
};
216
};
217
217
218
subtest 'build_query tests' => sub {
218
subtest 'build_query tests' => sub {
219
    plan tests => 50;
219
    plan tests => 51;
220
220
221
    my $qb;
221
    my $qb;
222
222
Lines 244-252 subtest 'build_query tests' => sub { Link Here
244
    );
244
    );
245
245
246
    t::lib::Mocks::mock_preference('FacetMaxCount','37');
246
    t::lib::Mocks::mock_preference('FacetMaxCount','37');
247
    t::lib::Mocks::mock_preference('DisplayLibraryFacets','both');
247
    $query = $qb->build_query('test', %options);
248
    $query = $qb->build_query('test', %options);
248
    ok( defined $query->{aggregations}{ccode}{terms}{size},'we need to ask for a size or we get only 5 facet' );
249
    ok( defined $query->{aggregations}{ccode}{terms}{size},'we need to ask for a size or we get only 5 facet' );
249
    is( $query->{aggregations}{ccode}{terms}{size}, 37,'we ask for the size as defined by the syspref FacetMaxCount');
250
    is( $query->{aggregations}{ccode}{terms}{size}, 37,'we ask for the size as defined by the syspref FacetMaxCount');
251
    is( $query->{aggregations}{homebranch}{terms}{size}, 37,'we ask for the size as defined by the syspref FacetMaxCount fir homebranch');
250
252
251
    t::lib::Mocks::mock_preference('DisplayLibraryFacets','both');
253
    t::lib::Mocks::mock_preference('DisplayLibraryFacets','both');
252
    $query = $qb->build_query();
254
    $query = $qb->build_query();
253
- 

Return to bug 26009