From 585daf17bffe9ef96ad2e71d261285da9f42f9e5 Mon Sep 17 00:00:00 2001 From: David Gustafsson Date: Tue, 29 Aug 2017 15:44:35 +0200 Subject: [PATCH] Change hardcoded instances of lower case "or" in search queries to be compatible with ElasticSearch query syntax https://bugs.koha-community.org/show_bug.cgi?id=19197 --- C4/Matcher.pm | 2 +- catalogue/search.pl | 2 +- opac/opac-search.pl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/C4/Matcher.pm b/C4/Matcher.pm index 7209511d76..7822a92bf3 100644 --- a/C4/Matcher.pm +++ b/C4/Matcher.pm @@ -659,7 +659,7 @@ sub get_matches { } else { my $phr = ( C4::Context->preference('AggressiveMatchOnISBN') || C4::Context->preference('AggressiveMatchOnISSN') ) ? ',phr' : q{}; - $query = join( " or ", + $query = join( " OR ", map { "$matchpoint->{'index'}$phr=\"$_\"" } @source_keys ); #NOTE: double-quote the values so you don't get a "Embedded truncation not supported" error when a term has a ? in it. } diff --git a/catalogue/search.pl b/catalogue/search.pl index 27b36b7802..ea21f5d5c5 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -399,7 +399,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: ' . $_->id } @libraries ) .')'; + my $multibranch = '('.join( " OR ", map { 'branch: ' . $_->id } @libraries ) .')'; push @limits, $multibranch if ($multibranch ne '()'); } diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 82a0319b82..ecff8e6f69 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -493,7 +493,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: ' . $_->id } @libraries ) .')'; + my $multibranch = '('.join( " OR ", map { 'branch: ' . $_->id } @libraries ) .')'; push @limits, $multibranch if ($multibranch ne '()'); } -- 2.11.0