forge/app/Console/Commands/SearchSyncCommand.php
Refringe 16e3a67efd
Query Optimization
- Download counts were taking too long to calculate dynamically, so we're keeping track of a total count with observers and queued job.
- Optimized the SQL used to order a mod listing by mod version update times.
2024-08-31 01:19:22 -04:00

24 lines
677 B
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
class SearchSyncCommand extends Command
{
protected $signature = 'app:search-sync';
protected $description = 'Syncs all search settings and indexes with the database data';
public function handle(): void
{
Artisan::call('scout:delete-all-indexes');
Artisan::call('scout:sync-index-settings');
Artisan::call('scout:import', ['model' => '\App\Models\Mod']);
Artisan::call('scout:import', ['model' => '\App\Models\User']);
$this->info('The search synchronisation jobs have been added to the queue');
}
}