Added Downloads to search index.

This commit is contained in:
orasche committed 2026-08-21 15:44:03 +02:00
1 parent 710f95794c
commit cf7a04ea15
6 files changed
+295 -22

No files matched your search

@@ -36,6 +36,7 @@ class SolrIndexCommand extends Command
$this->addOption('limit', 'l', InputOption::VALUE_REQUIRED, 'Max queue items to index in this run', '20');
$this->addOption('root', 'r', InputOption::VALUE_REQUIRED, 'Root page uid of the site', '1');
$this->addOption('debug', 'd', InputOption::VALUE_NONE, 'Single-step the first queue item verbosely');
$this->addOption('initialize', 'i', InputOption::VALUE_REQUIRED, 'Initialize the index queue for these configurations (comma list or *) before indexing');
}
protected function execute(InputInterface $input, OutputInterface $output): int
@@ -68,7 +69,21 @@ class SolrIndexCommand extends Command
return Command::FAILURE;
}
$initialize = (string)($input->getOption('initialize') ?? '');
if ($initialize !== '') {
$names = $initialize === '*' ? ['*'] : array_map('trim', explode(',', $initialize));
$initService = GeneralUtility::makeInstance(\ApacheSolrForTypo3\Solr\Domain\Index\Queue\QueueInitializationService::class);
$result = $initService->initializeBySiteAndIndexConfigurations($site, $names);
foreach ($result as $name => $ok) {
$output->writeln(' initialized ' . $name . ': ' . var_export($ok, true));
}
}
if ($input->getOption('debug')) {
$queueConfig = $site->getSolrConfiguration()->getObjectByPathOrDefault('plugin.tx_solr.index.queue.');
$output->writeln('index.queue keys: ' . implode(', ', array_keys($queueConfig)));
$output->writeln('products.table: ' . var_export($queueConfig['products.']['table'] ?? null, true));
$queue = GeneralUtility::makeInstance(Queue::class);
$items = $queue->getItemsToIndex($site, 5);
$output->writeln('getItemsToIndex(5): ' . count($items) . ' items');