X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/87e18b80684dedc761e669d375f59b548e4ab52f..refs/pull/2393/head:/app/Console/Commands/RegenerateSearch.php diff --git a/app/Console/Commands/RegenerateSearch.php b/app/Console/Commands/RegenerateSearch.php index 35ecd46c0..3dc3ec0af 100644 --- a/app/Console/Commands/RegenerateSearch.php +++ b/app/Console/Commands/RegenerateSearch.php @@ -2,7 +2,8 @@ namespace BookStack\Console\Commands; -use BookStack\Services\SearchService; +use BookStack\Entities\Tools\SearchIndex; +use DB; use Illuminate\Console\Command; class RegenerateSearch extends Command @@ -19,19 +20,17 @@ class RegenerateSearch extends Command * * @var string */ - protected $description = 'Command description'; + protected $description = 'Re-index all content for searching'; - protected $searchService; + protected $searchIndex; /** * Create a new command instance. - * - * @param SearchService $searchService */ - public function __construct(SearchService $searchService) + public function __construct(SearchIndex $searchIndex) { parent::__construct(); - $this->searchService = $searchService; + $this->searchIndex = $searchIndex; } /** @@ -41,13 +40,13 @@ class RegenerateSearch extends Command */ public function handle() { - $connection = \DB::getDefaultConnection(); + $connection = DB::getDefaultConnection(); if ($this->option('database') !== null) { - \DB::setDefaultConnection($this->option('database')); + DB::setDefaultConnection($this->option('database')); } - $this->searchService->indexAllEntities(); - \DB::setDefaultConnection($connection); + $this->searchIndex->indexAllEntities(); + DB::setDefaultConnection($connection); $this->comment('Search index regenerated'); } }