Exemplo n.º 1
0
 /**
  * Deletes/remaps an index type, populates it, and refreshes the index.
  *
  * @param OutputInterface $output
  * @param string          $index
  * @param string          $type
  * @param boolean         $reset
  * @param array           $options
  */
 private function populateIndexType(OutputInterface $output, $index, $type, $reset, $options)
 {
     $event = new TypePopulateEvent($index, $type, $reset, $options);
     $this->dispatcher->dispatch(TypePopulateEvent::PRE_TYPE_POPULATE, $event);
     if ($event->isReset()) {
         $output->writeln(sprintf('<info>Resetting</info> <comment>%s/%s</comment>', $index, $type));
         $this->resetter->resetIndexType($index, $type);
     }
     $provider = $this->providerRegistry->getProvider($index, $type);
     $loggerClosure = $this->progressClosureBuilder->build($output, 'Populating', $index, $type);
     $provider->populate($loggerClosure, $event->getOptions());
     $this->dispatcher->dispatch(TypePopulateEvent::POST_TYPE_POPULATE, $event);
     $this->refreshIndex($output, $index, false);
 }
 /**
  * Deletes/remaps an index type, populates it, and refreshes the index.
  *
  * @param OutputInterface $output
  * @param string          $index
  * @param string          $type
  * @param boolean         $reset
  * @param array           $options
  */
 private function populateIndexType(OutputInterface $output, $index, $type, $reset, $options)
 {
     if ($reset) {
         $output->writeln(sprintf('<info>Resetting</info> <comment>%s/%s</comment>', $index, $type));
         $this->resetter->resetIndexType($index, $type);
     }
     $loggerClosure = function ($message) use($output, $index, $type) {
         $output->writeln(sprintf('<info>Populating</info> %s/%s, %s', $index, $type, $message));
     };
     $provider = $this->providerRegistry->getProvider($index, $type);
     $provider->populate($loggerClosure, $options);
     $output->writeln(sprintf('<info>Refreshing</info> <comment>%s</comment>', $index));
     $this->indexManager->getIndex($index)->refresh();
 }