diff --git a/.github/README.md b/.github/README.md index f3c839b..aa584bd 100644 --- a/.github/README.md +++ b/.github/README.md @@ -59,6 +59,11 @@ sail artisan migrate:fresh –seed sail artisan horizon ``` +``` +# Sync the local database with the Meilisearch server (requires horizon to be running): +sail artisan app:search-sync +``` + ``` # Install NPM dependencies from within the container: sail npm install diff --git a/app/Console/Commands/SearchSync.php b/app/Console/Commands/SearchSync.php new file mode 100644 index 0000000..9ba27b4 --- /dev/null +++ b/app/Console/Commands/SearchSync.php @@ -0,0 +1,23 @@ + '\App\Models\Mod']); + Artisan::call('scout:import', ['model' => '\App\Models\User']); + + $this->info('The search synchronisation jobs have been added to the queue.'); + } +} diff --git a/app/Jobs/ImportHubData.php b/app/Jobs/ImportHubData.php index faaa631..dbae4fb 100644 --- a/app/Jobs/ImportHubData.php +++ b/app/Jobs/ImportHubData.php @@ -52,11 +52,8 @@ class ImportHubData implements ShouldBeUnique, ShouldQueue // Ensure that we've disconnected from the Hub database, clearing temporary tables. DB::connection('mysql_hub')->disconnect(); - // Reindex the Meilisearch index. - 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']); + // Re-sync search. + Artisan::call('app:search-sync'); } /**