31 lines
827 B
PHP
31 lines
827 B
PHP
|
|
<?php
|
|||
|
|
|
|||
|
|
namespace App\Console\Commands;
|
|||
|
|
|
|||
|
|
use App\Services\Recherche\IndexRecherche;
|
|||
|
|
use Illuminate\Console\Command;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Rejoue l'index de recherche (bloc C) depuis les tables labs/cours —
|
|||
|
|
* appelé après labs:synchroniser et cours:synchroniser, et disponible ici
|
|||
|
|
* pour une reconstruction manuelle (changement de mapping, par exemple).
|
|||
|
|
*/
|
|||
|
|
class IndexerRecherche extends Command
|
|||
|
|
{
|
|||
|
|
protected $signature = 'recherche:indexer';
|
|||
|
|
|
|||
|
|
protected $description = 'Reconstruit l’index de recherche (cours et labs) dans Elasticsearch';
|
|||
|
|
|
|||
|
|
public function handle(): void
|
|||
|
|
{
|
|||
|
|
if (! IndexRecherche::disponible()) {
|
|||
|
|
$this->warn('Elasticsearch non configuré : rien à indexer.');
|
|||
|
|
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
IndexRecherche::reconstruire();
|
|||
|
|
$this->info('Index reconstruit.');
|
|||
|
|
}
|
|||
|
|
}
|