/**
  * @see Symfony\Component\Console\Command\Command::execute()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $index = $input->getOption('index');
     $force = (bool) $input->getOption('force');
     $indexes = null === $index ? array_keys($this->indexManager->getAllIndexes()) : array($index);
     foreach ($indexes as $index) {
         $output->writeln(sprintf('<info>Resetting</info> <comment>%s</comment>', $index));
         $this->resetter->resetIndex($index, false, $force);
     }
 }
 /**
  * Refreshes an index.
  *
  * @param OutputInterface $output
  * @param string          $index
  * @param bool            $postPopulate
  */
 private function refreshIndex(OutputInterface $output, $index, $postPopulate = true)
 {
     if ($postPopulate) {
         $this->resetter->postPopulate($index);
     }
     $output->writeln(sprintf('<info>Refreshing</info> <comment>%s</comment>', $index));
     $this->indexManager->getIndex($index)->refresh();
 }
 /**
  * @see Symfony\Component\Console\Command\Command::execute()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $index = $input->getOption('index');
     $type = $input->getOption('type');
     if (null === $index && null !== $type) {
         throw new \InvalidArgumentException('Cannot specify type option without an index.');
     }
     if (null !== $type) {
         $output->writeln(sprintf('<info>Resetting</info> <comment>%s/%s</comment>', $index, $type));
         $this->resetter->resetIndexType($index, $type);
     } else {
         $indexes = null === $index ? array_keys($this->indexManager->getAllIndexes()) : array($index);
         foreach ($indexes as $index) {
             $output->writeln(sprintf('<info>Resetting</info> <comment>%s</comment>', $index));
             $this->resetter->resetIndex($index);
         }
     }
 }
 /**
  * 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();
 }
 public function testGetDefaultIndex()
 {
     $this->assertEquals('test2', $this->indexManager->getIndex());
     $this->assertEquals('test2', $this->indexManager->getDefaultIndex());
 }