fn_b/app/Console/Commands/EditorialReindex.php

28 lines
687 B
PHP

<?php
namespace App\Console\Commands;
use App\Services\Editorial\PublicationEffects;
use Illuminate\Console\Command;
final class EditorialReindex extends Command
{
protected $signature = 'editorial:reindex';
protected $description = 'Initialize the isolated FNA_V3 site search index';
public function handle(PublicationEffects $effects): int
{
try {
$result = $effects->index();
$this->line(json_encode($result, JSON_UNESCAPED_UNICODE));
return $result['status'] === 'done' ? 0 : 1;
} catch (\Throwable) {
$this->error('Search index synchronization failed.');
return 1;
}
}
}