diff --git a/src/Index/Indexer.php b/src/Index/Indexer.php index aa1f296..da84446 100644 --- a/src/Index/Indexer.php +++ b/src/Index/Indexer.php @@ -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; @@ -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 %s', $documentable->getIndexCode())); + $documentable instanceof PrefixedDocumentableInterface && !empty($documentable->getPrefix()) ? + $output->writeln(sprintf('Indexing %s (Prefix: %s)', $documentable->getIndexCode(), $documentable->getPrefix())) + : $output->writeln(sprintf('Indexing %s', $documentable->getIndexCode())); $this->indexDocumentable($output, $documentable); } } @@ -160,10 +163,16 @@ private function indexDocumentable(OutputInterface $output, DocumentableInterfac { if (null === $locale && $documentable->isTranslatable()) { foreach ($this->getLocales() as $localeCode) { - $output->writeln( - sprintf('Indexing %s for locale %s', $documentable->getIndexCode(), $localeCode), - OutputInterface::VERBOSITY_VERBOSE - ); + $documentable instanceof PrefixedDocumentableInterface && !empty($documentable->getPrefix()) ? + $output->writeln( + sprintf('Indexing %s for locale %s (Prefix: %s)', $documentable->getIndexCode(), $localeCode, $documentable->getPrefix()), + OutputInterface::VERBOSITY_VERBOSE + ) + : $output->writeln( + sprintf('Indexing %s for locale %s', $documentable->getIndexCode(), $localeCode), + OutputInterface::VERBOSITY_VERBOSE + ); + $this->indexDocumentable($output, $documentable, $localeCode); }