mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-12 12:10:41 -05:00
Adds Search Sync Command
Adds an artisan app command that handles all of the search set-up and sync needed to get going. `artisan app:search-sync`
This commit is contained in:
parent
fd5dc7cf20
commit
cb636fd197
5
.github/README.md
vendored
5
.github/README.md
vendored
@ -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
|
||||
|
23
app/Console/Commands/SearchSync.php
Normal file
23
app/Console/Commands/SearchSync.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
class SearchSync 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.');
|
||||
}
|
||||
}
|
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user