+ $connection = DB::getDefaultConnection();
+ if ($this->option('database') !== null) {
+ DB::setDefaultConnection($this->option('database'));
+ }
+
+ $this->searchIndex->indexAllEntities();
+ DB::setDefaultConnection($connection);
+ $this->comment('Search index regenerated');