From cbe0d3575779175825a8e4fe17ca63a46215d47f Mon Sep 17 00:00:00 2001 From: Victor Grousset/tuxayo Date: Wed, 22 Dec 2021 20:45:35 +0100 Subject: [PATCH] Bug 29284: REVERT ALL: due to string freeze Will be backported for next release Signed-off-by: Victor Grousset/tuxayo --- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 3 +-- catalogue/detail.pl | 17 ++++------------- catalogue/search.pl | 5 +---- .../prog/en/modules/catalogue/detail.tt | 6 ------ opac/opac-detail.pl | 17 +++++------------ opac/opac-search.pl | 5 +---- .../SearchEngine/Elasticsearch/QueryBuilder.t | 5 +---- 7 files changed, 13 insertions(+), 45 deletions(-) diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index 9627a3f6ce..a7cb7346d5 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -986,8 +986,7 @@ sub clean_search_term { $term =~ s/((?preference('UseControlNumber') and $record->field('001') ) ? 'rcn:'. $record->field('001')->data . ' AND (bib-level:a OR bib-level:b)' : "Host-item:($cleaned_title)"; - my ( $err, $result, $count ); - eval { - ( $err, $result, $count ) = - $searcher->simple_search_compat( $query, 0, 0 ); + my ( $err, $result, $count ) = $searcher->simple_search_compat( $query, 0, 0 ); - }; - if ($err || $@){ - my $error = q{}; - $error .= $err if $err; - $error .= $@ if $@; - warn "Warning from simple_search_compat: $error"; - $template->param( analytics_error => 1 ); - } + warn "Warning from simple_search_compat: $err" + if $err; my $variables = { - show_analytics_link => defined $count && $count > 0 ? 1 : 0 + show_analytics_link => $count > 0 ? 1 : 0 }; $template->param( diff --git a/catalogue/search.pl b/catalogue/search.pl index c9f2d7aeae..5c9bac7032 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -515,10 +515,7 @@ eval { }; if ($@ || $error) { - my $query_error = q{}; - $query_error .= $error if $error; - $query_error .= $@ if $@; - $template->param(query_error => $query_error); + $template->param(query_error => $error.$@); output_html_with_http_headers $cgi, $cookie, $template->output; exit; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index a6d99447bc..6f4b4ab02f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -80,12 +80,6 @@
Error: [% decoding_error | html %]
[% END %] - [% IF analytics_error %] -
- - There was an error searching for analytic records, please see the logs for details. -
- [% END %] [% IF ( ocoins ) %] diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index b5cccc04bd..fe84b254e8 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -190,21 +190,14 @@ if ( $xslfile ) { ( C4::Context->preference('UseControlNumber') and $record->field('001') ) ? 'rcn:'. $record->field('001')->data . ' AND (bib-level:a OR bib-level:b)' : "Host-item:($cleaned_title)"; - my ( $err, $result, $count ); - eval { - ( $err, $result, $count ) = - $searcher->simple_search_compat( $query, 0, 0 ); - }; - if ($err || $@){ - my $error = q{}; - $error .= $err if $err; - $error .= $@ if $@; - warn "Warning from simple_search_compat: $error"; - } + my ( $err, $result, $count ) = $searcher->simple_search_compat( $query, 0, 0 ); + + warn "Warning from simple_search_compat: $err" + if $err; my $variables = { anonymous_session => ($borrowernumber) ? 0 : 1, - show_analytics_link => defined $count && $count > 0 ? 1 : 0 + show_analytics_link => $count > 0 ? 1 : 0 }; my @plugin_responses = Koha::Plugins->call( diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 986490a604..cd0e0ae12a 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -597,10 +597,7 @@ if ($tag) { # use Data::Dumper; print STDERR "-" x 25, "\n", Dumper($results_hashref); if (not $tag and ( $@ || $error)) { - my $query_error = q{}; - $query_error .= $error if $error; - $query_error .= $@ if $@; - $template->param(query_error => $query_error); + $template->param(query_error => $error.$@); output_html_with_http_headers $cgi, $cookie, $template->output; exit; } diff --git a/t/Koha/SearchEngine/Elasticsearch/QueryBuilder.t b/t/Koha/SearchEngine/Elasticsearch/QueryBuilder.t index a507b2e065..2a2e950867 100755 --- a/t/Koha/SearchEngine/Elasticsearch/QueryBuilder.t +++ b/t/Koha/SearchEngine/Elasticsearch/QueryBuilder.t @@ -187,7 +187,7 @@ subtest '_split_query() tests' => sub { }; subtest 'clean_search_term() tests' => sub { - plan tests => 25; + plan tests => 24; my $qb; ok( @@ -239,9 +239,6 @@ subtest 'clean_search_term() tests' => sub { $res = $qb->clean_search_term('test! and more'); is($res, 'test and more', 'remove exclamation sign at with space after it'); - $res = $qb->clean_search_term('test! and more (and more!)'); - is($res, 'test and more (and more)', 'remove exclamation sign followed by close parentheses'); - $res = $qb->clean_search_term('!test'); is($res, '!test', 'exclamation sign left untouched'); -- 2.39.5