bulkIndex() public method

Bulk index list of content objects.
public bulkIndex ( array $contentList, callable $errorCallback )
$contentList array
$errorCallback callable (Content $content, NotFoundException $e)
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     @trigger_error(sprintf('%s is deprecated since 6.7. Use ezplatform:reindex command instead', $this->getName()), E_USER_DEPRECATED);
     $bulkCount = $input->getArgument('bulk_count');
     // Indexing Content
     $totalCount = $this->getContentObjectsTotalCount($this->databaseHandler, ContentInfo::STATUS_PUBLISHED);
     $query = $this->databaseHandler->createSelectQuery();
     $query->select('id', 'current_version')->from('ezcontentobject')->where($query->expr->eq('status', ContentInfo::STATUS_PUBLISHED));
     $stmt = $query->prepare();
     $stmt->execute();
     $this->searchHandler->purgeIndex();
     $output->writeln('Indexing Content...');
     /* @var \Symfony\Component\Console\Helper\ProgressHelper $progress */
     $progress = $this->getHelperSet()->get('progress');
     $progress->start($output, $totalCount);
     $i = 0;
     do {
         $contentObjects = [];
         for ($k = 0; $k <= $bulkCount; ++$k) {
             if (!($row = $stmt->fetch(PDO::FETCH_ASSOC))) {
                 break;
             }
             try {
                 $contentObjects[] = $this->persistenceHandler->contentHandler()->load($row['id'], $row['current_version']);
             } catch (NotFoundException $e) {
                 $this->logWarning($output, $progress, "Could not load current version of Content with id {$row['id']}, so skipped for indexing. Full exception: " . $e->getMessage());
             }
         }
         $this->searchHandler->bulkIndex($contentObjects, function (Content $content, NotFoundException $e) use($output, $progress) {
             $this->logWarning($output, $progress, 'Content with id ' . $content->versionInfo->id . ' has missing data, so skipped for indexing. Full exception: ' . $e->getMessage());
         });
         $progress->advance($k);
     } while (($i += $bulkCount) < $totalCount);
     $progress->finish();
 }