From feadab06dca2d5956c3d25073863152a353d839f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Mon, 5 Jun 2017 09:08:35 +0200 Subject: [PATCH] Bug 16976: Authorities searches with double quotes gives ZOOM error 20003 To recreate: Go to Home > Authorities Search "test" (including double quotes Result: Internal server error, plack error log says: ZOOM error 20003 "can't set prefix query" (addinfo: "@or @attr 7=1 @attr 1=Heading 0 @attr 1=Heading-Main @attr 5=1 @attr 4=6 "\\"test\\""") from diag-set 'ZOOM' To test: - Appply patch, restart memchached an dplack - Repeat search "test" - Verify that there is no internal server error - Add an authority containing quotes, e.g. Johann "Wolfie" Goethe - Search after Wolfie (without quotes) - Verify that authority ist found - Search after "Wolfie" - Verify that authority is found - Verify that other searches for authorities behave as before Technical note: Escaping did not work. The patch simply removes double quotes from search values. Not sure if that is the ultimate solution, but it works. Signed-off-by: Lee Jamison --- authorities/authorities-home.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/authorities/authorities-home.pl b/authorities/authorities-home.pl index d9c5ac8..a0ebeaf 100755 --- a/authorities/authorities-home.pl +++ b/authorities/authorities-home.pl @@ -82,7 +82,8 @@ if ( $op eq "do_search" ) { my $operator = $query->param('operator') || ''; my $orderby = $query->param('orderby') || ''; my $value = $query->param('value') || ''; - + my $value_no_doublequotes = $value; + $value_no_doublequotes =~ s/\"//g; my $startfrom = $query->param('startfrom') || 1; my $resultsperpage = $query->param('resultsperpage') || 20; @@ -92,7 +93,7 @@ if ( $op eq "do_search" ) { { index => $Koha::SearchEngine::AUTHORITIES_INDEX } ); my $search_query = $builder->build_authorities_query_compat( [$marclist], [$and_or], [$excluding], [$operator], - [$value], $authtypecode, $orderby + [$value_no_doublequotes], $authtypecode, $orderby ); my $offset = ( $startfrom - 1 ) * $resultsperpage + 1; my ( $results, $total ) = -- 2.1.4