Skip to content

Commit

Permalink
Display index prefix on reindex console
Browse files Browse the repository at this point in the history
  • Loading branch information
maximehuran committed Aug 16, 2023
1 parent ecd1f1d commit 1951939
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/Index/Indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Jane\Component\AutoMapper\AutoMapperInterface;
use JoliCode\Elastically\Indexer as ElasticallyIndexer;
use MonsieurBiz\SyliusSearchPlugin\Model\Documentable\DocumentableInterface;
use MonsieurBiz\SyliusSearchPlugin\Model\Documentable\PrefixedDocumentableInterface;
use MonsieurBiz\SyliusSearchPlugin\Search\ClientFactory;
use Sylius\Component\Channel\Repository\ChannelRepositoryInterface;
use Sylius\Component\Core\Model\ChannelInterface;
Expand Down Expand Up @@ -64,7 +65,9 @@ public function indexAll(?OutputInterface $output = null): void
$output = $output ?? new NullOutput();
/** @var DocumentableInterface $documentable */
foreach ($this->documentableRegistry->all() as $documentable) {
$output->writeln(sprintf('Indexing <info>%s</info>', $documentable->getIndexCode()));
$documentable instanceof PrefixedDocumentableInterface ?
$output->writeln(sprintf('Indexing <info>%s</info> (Prefix: <info>%s</info>)', $documentable->getIndexCode(), $documentable->getPrefix()))
: $output->writeln(sprintf('Indexing <info>%s</info>', $documentable->getIndexCode()));
$this->indexDocumentable($output, $documentable);
}
}
Expand Down Expand Up @@ -160,10 +163,16 @@ private function indexDocumentable(OutputInterface $output, DocumentableInterfac
{
if (null === $locale && $documentable->isTranslatable()) {
foreach ($this->getLocales() as $localeCode) {
$output->writeln(
sprintf('Indexing <info>%s</info> for locale <info>%s</info>', $documentable->getIndexCode(), $localeCode),
OutputInterface::VERBOSITY_VERBOSE
);
$documentable instanceof PrefixedDocumentableInterface ?
$output->writeln(
sprintf('Indexing <info>%s</info> for locale <info>%s</info> (Prefix: <info>%s</info>)', $documentable->getIndexCode(), $localeCode, $documentable->getPrefix()),
OutputInterface::VERBOSITY_VERBOSE
)
: $output->writeln(
sprintf('Indexing <info>%s</info> for locale <info>%s</info>', $documentable->getIndexCode(), $localeCode),
OutputInterface::VERBOSITY_VERBOSE
);

$this->indexDocumentable($output, $documentable, $localeCode);
}

Expand Down

0 comments on commit 1951939

Please sign in to comment.