Lines 22-28
use warnings;
Link Here
|
22 |
|
22 |
|
23 |
use CGI qw ( -utf8 ); |
23 |
use CGI qw ( -utf8 ); |
24 |
use URI::Escape; |
24 |
use URI::Escape; |
25 |
use C4::Auth; |
25 |
use POSIX qw( ceil ); |
26 |
|
26 |
|
27 |
use C4::Context; |
27 |
use C4::Context; |
28 |
use C4::Auth; |
28 |
use C4::Auth; |
Lines 86-91
if ( $op eq "do_search" ) {
Link Here
|
86 |
|
86 |
|
87 |
my $startfrom = $query->param('startfrom') || 1; |
87 |
my $startfrom = $query->param('startfrom') || 1; |
88 |
my $resultsperpage = $query->param('resultsperpage') || 20; |
88 |
my $resultsperpage = $query->param('resultsperpage') || 20; |
|
|
89 |
my $offset = ( $startfrom - 1 ) * $resultsperpage + 1; |
89 |
|
90 |
|
90 |
my $builder = Koha::SearchEngine::QueryBuilder->new( |
91 |
my $builder = Koha::SearchEngine::QueryBuilder->new( |
91 |
{ index => $Koha::SearchEngine::AUTHORITIES_INDEX } ); |
92 |
{ index => $Koha::SearchEngine::AUTHORITIES_INDEX } ); |
Lines 96-102
if ( $op eq "do_search" ) {
Link Here
|
96 |
[$value], $authtypecode, $orderby |
97 |
[$value], $authtypecode, $orderby |
97 |
); |
98 |
); |
98 |
my ( $results, $total ) = $searcher->search_auth_compat( |
99 |
my ( $results, $total ) = $searcher->search_auth_compat( |
99 |
$search_query, $startfrom, $resultsperpage |
100 |
$search_query, $offset, $resultsperpage |
100 |
); |
101 |
); |
101 |
|
102 |
|
102 |
( $template, $loggedinuser, $cookie ) = get_template_and_user( |
103 |
( $template, $loggedinuser, $cookie ) = get_template_and_user( |
Lines 180-194
if ( $op eq "do_search" ) {
Link Here
|
180 |
|
181 |
|
181 |
$template->param( result => $results ) if $results; |
182 |
$template->param( result => $results ) if $results; |
182 |
|
183 |
|
|
|
184 |
my $max_result_window = $searcher->max_result_window; |
185 |
my $hits_to_paginate = ($max_result_window && $max_result_window < $total) ? $max_result_window : $total; |
186 |
|
183 |
$template->param( |
187 |
$template->param( |
184 |
pagination_bar => pagination_bar( |
188 |
pagination_bar => pagination_bar( |
185 |
$base_url, int( $total / $resultsperpage ) + 1, |
189 |
$base_url, ceil( $hits_to_paginate / $resultsperpage ), |
186 |
$startfrom, 'startfrom' |
190 |
$startfrom, 'startfrom' |
187 |
), |
191 |
), |
188 |
total => $total, |
192 |
total => $total, |
189 |
from => $from, |
193 |
hits_to_paginate => $hits_to_paginate, |
190 |
to => $to, |
194 |
from => $from, |
191 |
isEDITORS => $authtypecode eq 'EDITORS', |
195 |
to => $to, |
|
|
196 |
isEDITORS => $authtypecode eq 'EDITORS', |
192 |
); |
197 |
); |
193 |
|
198 |
|
194 |
} |
199 |
} |
195 |
- |
|
|