diff --git a/bundle/EzPublishSolrSearchEngineBundle/Command/SolrCreateIndexCommand.php b/bundle/EzPublishSolrSearchEngineBundle/Command/SolrCreateIndexCommand.php index c28c46815..f621ee661 100644 --- a/bundle/EzPublishSolrSearchEngineBundle/Command/SolrCreateIndexCommand.php +++ b/bundle/EzPublishSolrSearchEngineBundle/Command/SolrCreateIndexCommand.php @@ -14,6 +14,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; +use eZ\Publish\SPI\Persistence\Content\ContentInfo; use PDO; class SolrCreateIndexCommand extends ContainerAwareCommand @@ -43,18 +44,18 @@ protected function execute(InputInterface $input, OutputInterface $output) $databaseHandler = $this->getContainer()->get('ezpublish.connection'); // Indexing Content - $query = $databaseHandler - ->createSelectQuery() - ->select('count(id)') - ->from('ezcontentobject'); + $query = $databaseHandler->createSelectQuery(); + $query->select('count(id)') + ->from('ezcontentobject') + ->where($query->expr->eq('status', ContentInfo::STATUS_PUBLISHED)); $stmt = $query->prepare(); $stmt->execute(); $totalCount = $stmt->fetchColumn(); - $query = $databaseHandler - ->createSelectQuery() - ->select('id', 'current_version') - ->from('ezcontentobject'); + $query = $databaseHandler->createSelectQuery(); + $query->select('id', 'current_version') + ->from('ezcontentobject') + ->where($query->expr->eq('status', ContentInfo::STATUS_PUBLISHED)); $stmt = $query->prepare(); $stmt->execute();