/** * Execute the console command. * * @return mixed */ public function handle() { // Fetch objects and delete redis sets $objects = Object::whereIn('object_id', Redis::smembers('objects:toReindex'))->get(); $collections = Collection::whereIn('collection_id', Redis::smembers('collections:toReindex'))->get(); $dataViews = DataView::whereIn('dataview_id', Redis::smembers('dataviews:toReindex'))->get(); Redis::del(['objects:toReindex', 'collections:toReindex', 'dataviews:toReindex']); // Map to return searchable interfaces and reindex if ($objects->count() > 0) { foreach ($objects as $object) { $searchableObjects[] = $object->search(); } Search::bulkReindex($searchableObjects); } if ($collections->count() > 0) { foreach ($collections as $collection) { $searchableCollections[] = $collection->search(); } Search::bulkReindex($searchableCollections); } if ($dataViews->count() > 0) { foreach ($dataViews as $dataView) { $searchableDataViews[] = $dataView->search(); } Search::bulkReindex($searchableDataViews); } }