use OpenILS::Utils::CStoreEditor qw/:funcs/;
use OpenILS::Utils::Fieldmapper;
use OpenILS::Application::AppUtils;
+use OpenSRF::Utils::JSON;
my $U = 'OpenILS::Application::AppUtils';
return ($query, $site, $depth);
}
+sub _get_search_limit {
+ my $self = shift;
+
+ # param takes precedence
+ my $limit = $self->cgi->param('limit');
+ return $limit if $limit;
+
+ if($self->editor->requestor) {
+ # See if the user has a hit count preference
+ my $lset = $self->editor->search_actor_user_setting({
+ usr => $self->editor->requestor->id,
+ name => 'opac.hits_per_page'
+ })->[0];
+ return OpenSRF::Utils::JSON->JSON2perl($lset->value) if $lset;
+ }
+
+ return 10; # default
+}
+
# context additions:
# page_size
# hit_count
$ctx->{page} = 'rresult';
my $page = $cgi->param('page') || 0;
my $facet = $cgi->param('facet');
- my $limit = $cgi->param('limit') || 10; # TODO user settings
+ my $limit = $self->_get_search_limit;
my $loc = $cgi->param('loc');
my $offset = $page * $limit;
[% PROCESS "default/opac/parts/misc_util.tt2";
ctx.result_start = 1 + ctx.page_size * page;
- ctx.result_stop = 1 + ctx.page_size * (page + 1);
+ ctx.result_stop = ctx.page_size * (page + 1);
IF ctx.result_stop > ctx.hit_count; ctx.result_stop = ctx.hit_count; END;
result_count = ctx.result_start;