Bugzilla – Attachment 126586 Details for
Bug 29284
Koha dies when an analytics search fails in Elasticsearch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29284: Don't die on analytics searchign error
Bug-29284-Dont-die-on-analytics-searchign-error.patch (text/plain), 3.76 KB, created by
Martin Renvoize
on 2021-10-20 13:25:50 UTC
(
hide
)
Description:
Bug 29284: Don't die on analytics searchign error
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2021-10-20 13:25:50 UTC
Size:
3.76 KB
patch
obsolete
>From d3739bf945afedc6d4c4c4dab5b7f8312422baf8 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 20 Oct 2021 12:46:07 +0000 >Subject: [PATCH] Bug 29284: Don't die on analytics searchign error > >This patch adds an eval around the call to search for analytic records >It pases a value to the template on the staff side, but logs the warning on >the opac > >This seems similar to 'decoding_error' which is noted on staff side, but absent on OPAC > >The eval follows the patter used during searching > >To test: >1 - Add a title to catalog, with 245a: > Digger does it all (not really!) >2 - Set searchEngine preference to: Elasticsearch >3 - The record does not load >4 - Apply patch >5 - The record loads, there is a note about analytics at the top fo the record >6 - View record in opac, no note >7 - Check logs on intranet and opac, searching error is logged > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > catalogue/detail.pl | 12 +++++++++--- > .../prog/en/modules/catalogue/detail.tt | 6 ++++++ > opac/opac-detail.pl | 11 ++++++++--- > 3 files changed, 23 insertions(+), 6 deletions(-) > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index b5801cca71..4efffed9b8 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -140,10 +140,16 @@ my $marcflavour = C4::Context->preference("marcflavour"); > ( 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 ) = $searcher->simple_search_compat( $query, 0, 0 ); >+ my ( $err, $result, $count ); >+ eval { >+ ( $err, $result, $count ) = >+ $searcher->simple_search_compat( $query, 0, 0 ); > >- warn "Warning from simple_search_compat: $err" >- if $err; >+ }; >+ if ($err || $@){ >+ warn "Warning from simple_search_compat: $err.$@"; >+ $template->param( analytics_error => 1 ); >+ } > > my $variables = { > show_analytics_link => $count > 0 ? 1 : 0 >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 7c2b961d6c..57f7ac3d1c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -101,6 +101,12 @@ > <span class="error"><br/> Error: [% decoding_error | html %]</span> > </div> > [% END %] >+ [% IF analytics_error %] >+ <div> >+ <span class="analytics_error"> >+ There was an error searching for analytic records, please see the logs for details.</span> >+ </div> >+ [% END %] > [% IF ( ocoins ) %] > <!-- COinS / OpenURL --> > <span class="Z3988" title="[% ocoins | html %]"></span> >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index eb9a6866b1..36c64d4f60 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -210,10 +210,15 @@ my $ean = GetNormalizedEAN( $record, $marcflavour ); > ( 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 ) = $searcher->simple_search_compat( $query, 0, 0 ); >+ my ( $err, $result, $count ); >+ eval { >+ ( $err, $result, $count ) = >+ $searcher->simple_search_compat( $query, 0, 0 ); > >- warn "Warning from simple_search_compat: $err" >- if $err; >+ }; >+ if ($err || $@){ >+ warn "Warning from simple_search_compat: $err.$@"; >+ } > > my $variables = { > anonymous_session => ($borrowernumber) ? 0 : 1, >-- >2.20.1
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 29284
:
126583
|
126584
| 126586 |
126587
|
126656
|
126657
|
126658