From 74d36a9e1b697be2a9841c25b55e08f5565690e4 Mon Sep 17 00:00:00 2001
From: Tomas Cohen Arazi <tomascohen@theke.io>
Date: Tue, 12 Sep 2017 12:15:07 -0300
Subject: [PATCH] Bug 18374: (QA followup) Remove warning in
 Elasticsearch/Search.pm

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
---
 Koha/SearchEngine/Elasticsearch/Search.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Koha/SearchEngine/Elasticsearch/Search.pm b/Koha/SearchEngine/Elasticsearch/Search.pm
index cec1cb7fb6..4d584f7906 100644
--- a/Koha/SearchEngine/Elasticsearch/Search.pm
+++ b/Koha/SearchEngine/Elasticsearch/Search.pm
@@ -148,8 +148,10 @@ sub search_compat {
         $branches, $query_type,       $scan
     ) = @_;
     my %options;
+    if ( !defined $offset or $offset < 0 ) {
+        $offset = 0;
+    }
     $options{offset} = $offset;
-    $offset = 0 if $offset < 0;
     $options{expanded_facet} = $expanded_facet;
     my $results = $self->search($query, undef, $results_per_page, %options);
 
-- 
2.11.0