Bugzilla – Attachment 171004 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.69 KB, created by
Hammat wele
on 2024-09-03 21:39:18 UTC
(
hide
)
Description:
Bug 30745: Display pagination for the results page
Filename:
MIME Type:
Creator:
Hammat wele
Created:
2024-09-03 21:39:18 UTC
Size:
6.69 KB
patch
obsolete
>From 6aa7eadf0b487ca168db0daf7ce953626ddb07e9 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 03205a9a56..5f43c75622 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt >@@ -6,7 +6,7 @@ > <ul class="pagination"> > [% IF ( displayprev ) %] > <li class="page-item"> >- <a class="page-link" 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> >+ <a class="page-link" href="label-item-search.pl?startfrom=[% startfromprev | html %]&idx=[% idx | html %]&resultsperpage=[% resultsperpage | html %]&op=do_search&batch_id=[% batch_id | html %]&ccl_textbox=[% ccl_textbox | html %]&limits=[% limits | html %]"><i class="fa fa-arrow-left"></i> Previous</a> > </li> > [% END %] > [% FOREACH number IN numbers %] >@@ -16,13 +16,13 @@ > </li> > [% ELSE %] > <li class="page-item"> >- <a class="page-link" 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> >+ <a class="page-link" href="label-item-search.pl?startfrom=[% number.startfrom | html %]&idx=[% idx | html %]&resultsperpage=[% resultsperpage | html %]&op=do_search&batch_id=[% batch_id | html %]&ccl_textbox=[% ccl_textbox | html %]&limits=[% limits | html %]">[% number.number | html %]</a> > </li> > [% END %] > [% END %] > [% IF ( displaynext ) %] > <li class="page-item"> >- <a class="page-link" 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> >+ <a class="page-link" href="label-item-search.pl?startfrom=[% startfromnext | html %]&idx=[% idx | html %]&resultsperpage=[% resultsperpage | html %]&op=do_search&batch_id=[% batch_id | html %]&ccl_textbox=[% ccl_textbox | html %]&limits=[% limits | html %]">Next <i class="fa fa-arrow-right"></i></a> > </li> > [% END %] > </ul> >@@ -60,7 +60,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