diff --git a/www/plugins/es/js/controllers/document-controllers.js b/www/plugins/es/js/controllers/document-controllers.js
index a37042ea3ce8dd6343d1a55dd9043db4b6e00f2d..f16187b566bf69405bc4781d6c6377aece9c6883 100644
--- a/www/plugins/es/js/controllers/document-controllers.js
+++ b/www/plugins/es/js/controllers/document-controllers.js
@@ -76,9 +76,9 @@ function ESDocumentLookupController($scope, $ionicPopover, $location, $timeout,
 
     $scope.search.loading = true;
 
-    var searchFn =  $scope.search.last
-      ? esDocument.search(options)
-      : esDocument.searchText($scope.search.text||'', options);
+    var searchFn =  $scope.search.last ?
+      esDocument.search(options) :
+      esDocument.searchText($scope.search.text||'', options);
     return searchFn
       .then(function(res) {
         $scope.search.results = res.hits;