|null 응답에 실을 페이로드 (점검 불가 엔진이면 null) */ protected function rebuildSearchIndexIfRequested(bool $requested): ?array { $manager = app(SearchIndexMaintenanceManager::class); // 점검을 제공하지 않는 엔진에서는 실을 정보가 없다 (검색 자체는 정상 동작) if (! $manager->hasMaintainer() || $manager->unavailableReason() !== null) { return null; } if ($requested) { return ['rebuilt' => true] + $manager->repairStale()->toArray(); } $stale = array_values(array_filter($manager->inspect(), fn ($health) => $health->needsRebuild())); return [ 'rebuilt' => false, 'driver' => $manager->driver(), 'stale' => array_map(fn ($health) => $health->identifier, $stale), 'stale_count' => count($stale), ]; } }