Bugzilla – Attachment 107916 Details for
Bug 26009
Elasticsearch homebranch and holdingbranch facets are limited to 10
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26009: Add facet size to home/holdingbranch
Bug-26009-Add-facet-size-to-homeholdingbranch.patch (text/plain), 3.07 KB, created by
Josef Moravec
on 2020-08-06 19:17:20 UTC
(
hide
)
Description:
Bug 26009: Add facet size to home/holdingbranch
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2020-08-06 19:17:20 UTC
Size:
3.07 KB
patch
obsolete
>From 987fa418a6a61a2441582c7c07e8c24e71eec52d Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 17 Jul 2020 16:23:42 +0000 >Subject: [PATCH] Bug 26009: Add facet size to home/holdingbranch > >To test: >0 - Set DisplayLibraryFacets to 'both' and FacetMaxCount to 20 >1 - Have more than 10 branches >2 - Have items in each of those branches >3 - Enable ES, set system preference SearchEngine to Elasticsearch >4 - Search for '*' >5 - Expand homebranch/holdingbranch facets >6 - Note you only get 10 >7 - Apply patch >8 - Repeat search >9 - Now you get all your facets > >Signed-off-by: Michael Springer <mspringer@mylakelibrary.org> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 4 ++-- > t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t | 4 +++- > 2 files changed, 5 insertions(+), 3 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >index 3c6aaa42b1..4d69dcf95b 100644 >--- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >+++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >@@ -132,11 +132,11 @@ sub build_query { > 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; > } >diff --git a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t b/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >index 7ef261c6c9..ee8b81a4a7 100644 >--- a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >+++ b/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >@@ -216,7 +216,7 @@ subtest 'build_authorities_query_compat() tests' => sub { > }; > > subtest 'build_query tests' => sub { >- plan tests => 50; >+ plan tests => 51; > > my $qb; > >@@ -244,9 +244,11 @@ subtest 'build_query tests' => sub { > ); > > 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(); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26009
:
107044
|
107717
| 107916 |
107917