From 67de11e0fc90db5c745d394af27eab04f276bbe1 Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 5 Sep 2019 13:01:03 +0000 Subject: [PATCH] Bug 19197: Fix multibranch limits in ElasticSearch Two issues here: 1 - OR must be capitalized 2 - The 'branch' is not analyzed and turned into 'homebranch' correctly. If we specify 'homebranch' we can later build in a 'holdingbranch' search too To test: 1 - Go to Administration -> Library Groups 2 - Create a search group for staff and opac 3 - Add two libraries 4 - Perform an advanced search, limit to the group you just created 5 - Note the number of results 6 - Switch SearchEngine syspref to 'Elasticsearch' 7 - Repeat search, note it fails 8 - Apply patch 9 - Restart all the things 10 - Repeat the search 11 - Success! Number of results should match previous search 12 - Switch SearchEngine to 'Zebra' 13 - Repeat search 14 - Success! Search works and number of results matches --- catalogue/search.pl | 2 +- opac/opac-search.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index a3a7015efc..901f0368e9 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -408,7 +408,7 @@ my %is_nolimit = map { $_ => 1 } @nolimits; if($params->{'multibranchlimit'}) { my $search_group = Koha::Library::Groups->find( $params->{multibranchlimit} ); my @libraries = $search_group->all_libraries; - my $multibranch = '('.join( " or ", map { 'branch: ' . $_->branchcode } @libraries ) .')'; + my $multibranch = '('.join( " OR ", map { 'homebranch: ' . $_->branchcode } @libraries ) .')'; push @limits, $multibranch if ($multibranch ne '()'); } diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 27d1f2ce5c..660c754f5a 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -500,7 +500,7 @@ if (@searchCategories > 0) { if($params->{'multibranchlimit'}) { my $search_group = Koha::Library::Groups->find( $params->{multibranchlimit} ); my @libraries = $search_group->all_libraries; - my $multibranch = '('.join( " or ", map { 'branch: ' . $_->branchcode } @libraries ) .')'; + my $multibranch = '('.join( " OR ", map { 'homebranch: ' . $_->branchcode } @libraries ) .')'; push @limits, $multibranch if ($multibranch ne '()'); } -- 2.11.0