diff --git a/C4/Search.pm b/C4/Search.pm index 37dfb2cd6c..fa920cfbca 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -332,6 +332,7 @@ sub getRecords { my @servers = @$servers_ref; my @sort_by = @$sort_by_ref; + $offset = 0 if $offset < 0; # Initialize variables for the ZOOM connection and results object my $zconn; diff --git a/Koha/SearchEngine/Elasticsearch/Search.pm b/Koha/SearchEngine/Elasticsearch/Search.pm index 26bc4fc3c1..9f0e2a5991 100644 --- a/Koha/SearchEngine/Elasticsearch/Search.pm +++ b/Koha/SearchEngine/Elasticsearch/Search.pm @@ -149,6 +149,7 @@ sub search_compat { ) = @_; my %options; $options{offset} = $offset; + $offset = 0 if $offset < 0; $options{expanded_facet} = $expanded_facet; my $results = $self->search($query, undef, $results_per_page, %options);