]> BookStack Code Mirror - bookstack/blobdiff - app/Services/SearchService.php
Finished migration of last angular code
[bookstack] / app / Services / SearchService.php
index 670c1545d263a1d9995d5f87fbede79616b7a5a1..bb92a1d7c83cfcaba5f7eedd435865f44ac2a1a3 100644 (file)
@@ -50,6 +50,15 @@ class SearchService
         $this->permissionService = $permissionService;
     }
 
+    /**
+     * Set the database connection
+     * @param Connection $connection
+     */
+    public function setConnection(Connection $connection)
+    {
+        $this->db = $connection;
+    }
+
     /**
      * Search all entities in the system.
      * @param string $searchString
@@ -83,7 +92,7 @@ class SearchService
         return [
             'total' => $total,
             'count' => count($results),
-            'results' => $results->sortByDesc('score')
+            'results' => $results->sortByDesc('score')->values()
         ];
     }