Bugzilla – Attachment 157934 Details for
Bug 30745
Elasticsearch: Search never returns with after-date and/or before-date in label batch item search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30745: Display pagination for the results page
Bug-30745-Display-pagination-for-the-results-page.patch (text/plain), 6.64 KB, created by
Emily-Rose Francoeur
on 2023-10-26 15:34:12 UTC
(
hide
)
Description:
Bug 30745: Display pagination for the results page
Filename:
MIME Type:
Creator:
Emily-Rose Francoeur
Created:
2023-10-26 15:34:12 UTC
Size:
6.64 KB
patch
obsolete
>From 40e5e1f00fa6b4c38a8ab1464d8baf68b1b81350 Mon Sep 17 00:00:00 2001 >From: Emily-Rose Francoeur <emily-rose.francoeur@inLibro.com> >Date: Thu, 26 Oct 2023 11:28:35 -0400 >Subject: [PATCH] Bug 30745: Display pagination for the results page > >I have fixed the pagination issue when the search returns multiple results. > >Test plan: > - Enable elasticsearch > - git to labels/label-item-search.pl > - search using after date only > => check you get items with date-of-acquisition greater than after >date > - search using before date only > => check you get items with date-of-acquisition less than before >date > - search using after and before date > => check you get items with date-of-acquisition between after and >before > - Combine this searches with a specified index > - enable zebra and repeat these tests >pagination tests > - Perform a search that returns more than 20 notices > - Navigate through different result pages using page numbers, the "Next" button, and the "Previous" button > => On each page, check that "Results X through X of X" displays the correct information >--- > .../prog/en/modules/labels/result.tt | 7 ++--- > labels/label-item-search.pl | 29 +++++++++---------- > 2 files changed, 17 insertions(+), 19 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt >index e6b44617da..36090f5e3f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt >@@ -5,17 +5,17 @@ > [% IF ( displayprev || displaynext ) %] > <ul class="pagination"> > [% IF ( displayprev ) %] >- <li><a class="nav" href="label-item-search.pl?startfrom=[% startfromprev | html %]&ccl_query=[% ccl_query | html %]&resultsperpage=[% resultsperpage | html %]&op=do_search&batch_id=[% batch_id | html %]"><i class="fa fa-arrow-left"></i> Previous</a></li> >+ <li><a class="nav" href="label-item-search.pl?startfrom=[% startfromprev | html %]&idx=[% idx | html %]&ccl_textbox=[% ccl_textbox | html %]&limits=[% limits | html %]&resultsperpage=[% resultsperpage | html %]&op=do_search&batch_id=[% batch_id | html %]"><i class="fa fa-arrow-left"></i> Previous</a></li> > [% END %] > [% FOREACH number IN numbers %] > [% IF ( startfrom == number.startfrom ) %] > <li class="active"><span>[% number.number | html %]</span></a></li> > [% ELSE %] >- <li><a class="nav" href="label-item-search.pl?startfrom=[% number.startfrom | html %]&ccl_query=[% ccl_query | html %]&resultsperpage=[% resultsperpage | html %]&op=do_search&batch_id=[% batch_id | html %]">[% number.number | html %]</a></li> >+ <li><a class="nav" href="label-item-search.pl?startfrom=[% number.startfrom | html %]&idx=[% idx | html %]&ccl_textbox=[% ccl_textbox | html %]&limits=[% limits | html %]&resultsperpage=[% resultsperpage | html %]&op=do_search&batch_id=[% batch_id | html %]">[% number.number | html %]</a></li> > [% END %] > [% END %] > [% IF ( displaynext ) %] >- <li><a class="nav" href="label-item-search.pl?startfrom=[% startfromnext | html %]&ccl_query=[% ccl_query | html %]&resultsperpage=[% resultsperpage | html %]&op=do_search&batch_id=[% batch_id | html %]">Next <i class="fa fa-arrow-right"></i></a></li> >+ <li><a class="nav" href="label-item-search.pl?startfrom=[% startfromnext | html %]&idx=[% idx | html %]&ccl_textbox=[% ccl_textbox | html %]&limits=[% limits | html %]&resultsperpage=[% resultsperpage | html %]&op=do_search&batch_id=[% batch_id | html %]">Next <i class="fa fa-arrow-right"></i></a></li> > [% END %] > </ul> > [% END %] >@@ -54,7 +54,6 @@ > </div> > > <div id="label-search-results" class="page-section"> >- <input type="hidden" name="ccl_query" value="[% ccl_query | html %]" /> > [% FOREACH result_se IN result_set %] > <div style="border-bottom:1px solid #CCC;padding:1em 0;"> > <h4>[% result_se.title | html %]</h4> >diff --git a/labels/label-item-search.pl b/labels/label-item-search.pl >index b07e4e1c93..8cebec8278 100755 >--- a/labels/label-item-search.pl >+++ b/labels/label-item-search.pl >@@ -40,7 +40,7 @@ my $query = CGI->new; > my $type = $query->param('type'); > my $op = $query->param('op') || ''; > my $batch_id = $query->param('batch_id'); >-my $ccl_query = $query->param('ccl_query'); >+my @limits = split(" AND ", $query->param('limits') || ""); > my $startfrom = $query->param('startfrom') || 1; > my ($template, $loggedinuser, $cookie) = (undef, undef, undef); > my ( >@@ -68,13 +68,9 @@ if ( $op eq "do_search" ) { > my $searcher = Koha::SearchEngine::Search->new( > { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); > >- my @limits; >- if ($datefrom) { >- push(@limits, "acqdate,ge,st-date-normalized=$datefrom"); >- } >- >- if ($dateto) { >- push(@limits, "acqdate,le,st-date-normalized=$dateto"); >+ if (!@limits) { >+ push(@limits, "acqdate,ge,st-date-normalized=$datefrom") if ($datefrom); >+ push(@limits, "acqdate,le,st-date-normalized=$dateto") if ($dateto); > } > > my ( $build_error, $query, $simple_query, $query_cgi, >@@ -90,8 +86,9 @@ if ( $op eq "do_search" ) { > ); > > if (!defined $error && @{$results->{biblioserver}{RECORDS}} ) { >- $show_results = @{$results->{biblioserver}{RECORDS}}; >- $marcresults = $results->{biblioserver}{RECORDS}; >+ $show_results = grep { defined $_ } @{$results->{biblioserver}{RECORDS}}; >+ $marcresults = [ grep { defined $_ } @{$results->{biblioserver}{RECORDS}} ]; >+ $total_hits = $results->{biblioserver}{hits}; > } > else { > Koha::Logger->get->warn("ERROR label-item-search: no results from simple_search_compat"); >@@ -196,11 +193,13 @@ if ($show_results) { > ); > > $template->param( >- results => ($show_results ? 1 : 0), >- result_set=> \@results_set, >- batch_id => $batch_id, >- type => $type, >- ccl_query => $ccl_query, >+ results => ($show_results ? 1 : 0), >+ result_set => \@results_set, >+ batch_id => $batch_id, >+ type => $type, >+ idx => $idx, >+ ccl_textbox => $ccl_textbox, >+ limits => join(" AND ", @limits), > ); > } > >-- >2.34.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 30745
:
134952
|
134953
|
135784
|
135785
|
135966
|
135967
|
157192
|
157194
|
157195
|
157934
|
162855
|
163955
|
170677
|
170678
|
170679
|
170680
|
170681
|
170682
|
170683
|
170684
|
170729
|
170730
|
170731
|
170732
|
170733
|
171002
|
171003
|
171004
|
171005
|
171006
|
173280
|
173943
|
173944
|
173945
|
173946
|
173947
|
174486
|
174487
|
174488
|
174489
|
174490
|
174491