diff --git a/inc/Action/Search.php b/inc/Action/Search.php
index 4cc3017facee6ead06ec8f19015a9c5d120ce205..3db42e114dd4cc873c3fc1d073c8a22ccd891b34 100644
--- a/inc/Action/Search.php
+++ b/inc/Action/Search.php
@@ -13,6 +13,10 @@ use dokuwiki\Action\Exception\ActionAbort;
  */
 class Search extends AbstractAction {
 
+    protected $pageLookupResults = array();
+    protected $fullTextResults = array();
+    protected $highlight = array();
+
     /** @inheritdoc */
     public function minimumPermission() {
         return AUTH_NONE;
@@ -47,11 +51,24 @@ class Search extends AbstractAction {
     /** @inheritdoc */
     public function tplContent()
     {
-        $search = new \dokuwiki\Ui\Search();
-        $search->execute();
+        $this->execute();
+
+        $search = new \dokuwiki\Ui\Search($this->pageLookupResults, $this->fullTextResults, $this->highlight);
         $search->show();
     }
 
+
+    /**
+     * run the search
+     */
+    protected function execute()
+    {
+        global $INPUT, $QUERY;
+        $this->pageLookupResults = ft_pageLookup($QUERY, true, useHeading('navigation'));
+        $this->fullTextResults = ft_pageSearch($QUERY, $highlight, $INPUT->str('sort'));
+        $this->highlight = $highlight;
+    }
+
     /**
      * Adjust the global query accordingly to the config search_limit_to_first_ns and search_default_fragment_behaviour
      *
diff --git a/inc/Ui/Search.php b/inc/Ui/Search.php
index 8a02e81391731ef3cc50671e0ae789c933b7263c..5a01b69190f81d9918a68ee8b963f692c5b21cd9 100644
--- a/inc/Ui/Search.php
+++ b/inc/Ui/Search.php
@@ -15,8 +15,12 @@ class Search extends Ui
 
     /**
      * Search constructor.
+     *
+     * @param array $pageLookupResults
+     * @param array $fullTextResults
+     * @param string $highlight
      */
-    public function __construct()
+    public function __construct(array $pageLookupResults, array $fullTextResults, $highlight)
     {
         global $QUERY;
         $Indexer = idx_get_indexer();
@@ -24,15 +28,9 @@ class Search extends Ui
         $this->query = $QUERY;
         $this->parsedQuery = ft_queryParser($Indexer, $QUERY);
         $this->searchState = new SearchState($this->parsedQuery);
-    }
 
-    /**
-     * run the search
-     */
-    public function execute()
-    {
-        $this->pageLookupResults = ft_pageLookup($this->query, true, useHeading('navigation'));
-        $this->fullTextResults = ft_pageSearch($this->query, $highlight);
+        $this->pageLookupResults = $pageLookupResults;
+        $this->fullTextResults = $fullTextResults;
         $this->highlight = $highlight;
     }