From a753a7b649e9f9551f43a964211261d5eae431fe Mon Sep 17 00:00:00 2001 From: Kevin Carnes Date: Wed, 25 May 2022 10:54:25 +0000 Subject: [PATCH] Bug 30844: The OPAC detail page's browser is limited to the current page of results when using Elasticsearch When viewing the detail page of the first or last record of a result page, it's not possible to browse to another page when using Elasticsearch. To test: 1) Search for "*" in the OPAC 2) Click on the last result of the page 3) Observe that you cannot browse to the next page 4) Apply the patch 5) Search for "*" in the OPAC 6) Click on the last result of the page 7) Observe that you can browse to the next page 8) Sign off Sponsored-by: Lund University Library Signed-off-by: David Nind Signed-off-by: Katrin Fischer --- opac/opac-detail.pl | 5 ++++- opac/opac-search.pl | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index b281c958f6..7b08e67832 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -86,6 +86,7 @@ use Koha::Reviews; use Koha::SearchEngine::Search; use Koha::SearchEngine::QueryBuilder; +use JSON qw( decode_json ); my $query = CGI->new(); @@ -247,7 +248,9 @@ if ($session->param('busc')) { $sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by); my ($error, $results_hashref, $facets); eval { - ($error, $results_hashref, $facets) = getRecords($arrParamsBusc->{'query'},$arrParamsBusc->{'simple_query'},\@sort_by,\@servers,$results_per_page,$offset,undef,$itemtypes,$arrParamsBusc->{'query_type'},$arrParamsBusc->{'scan'}); + my $searcher = Koha::SearchEngine::Search->new( + { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); + ($error, $results_hashref, $facets) = $searcher->search_compat(decode_json($arrParamsBusc->{'query'}),$arrParamsBusc->{'simple_query'},\@sort_by,\@servers,$results_per_page,$offset,undef,$itemtypes,$arrParamsBusc->{'query_type'},$arrParamsBusc->{'scan'}); }; my $hits; my @newresults; diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 15fd6e52d2..a1f0a14487 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -561,7 +561,7 @@ if ($tag) { # displays search results which should be hidden. # FIXME: No facets for tags search. } else { - $pasarParams .= '&query=' . uri_escape_utf8($query); + $pasarParams .= '&query=' . uri_escape_utf8(encode_json($query)); $pasarParams .= '&count=' . uri_escape_utf8($results_per_page); $pasarParams .= '&simple_query=' . uri_escape_utf8($simple_query); $pasarParams .= '&query_type=' . uri_escape_utf8($query_type) if ($query_type); -- 2.30.2