From d5e9fd05ab59be04b360d8964d6b042ab6f64394 Mon Sep 17 00:00:00 2001 From: Johannes Wachter Date: Wed, 5 Apr 2017 16:03:00 +0200 Subject: [PATCH] fixed reindex only published article for live --- Command/ReindexCommand.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Command/ReindexCommand.php b/Command/ReindexCommand.php index 2b855d1fc..55beda333 100644 --- a/Command/ReindexCommand.php +++ b/Command/ReindexCommand.php @@ -11,6 +11,7 @@ namespace Sulu\Bundle\ArticleBundle\Command; +use Sulu\Component\Content\Document\WorkflowStage; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Input\InputArgument; @@ -39,16 +40,17 @@ public function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { + $sql2 = 'SELECT * FROM [nt:unstructured] AS a WHERE [jcr:mixinTypes] = "sulu:article"'; + $id = 'sulu_article.elastic_search.article_indexer'; if ($input->getOption('live')) { $id = 'sulu_article.elastic_search.article_live_indexer'; + $sql2 .= ' AND [i18n:en-state] = ' . WorkflowStage::PUBLISHED; } $indexer = $this->getContainer()->get($id); $documentManager = $this->getContainer()->get('sulu_document_manager.document_manager'); - $query = $documentManager->createQuery( - 'SELECT * FROM [nt:unstructured] AS a WHERE [jcr:mixinTypes] = "sulu:article"' - ); + $query = $documentManager->createQuery($sql2); if ($input->getOption('clear')) { $indexer->clear();