Builder/ArticleIndexBuilder.php
private function buildForManager(Manager $manager, $destroy)
    {
        $name = $manager->getName();
        if (!$manager->indexExists()) {
            $this->output->writeln(sprintf('Create index for "<comment>%s</comment>" manager.', $name));
            $manager->createIndex();

            return;
        }

        if (!$destroy) {
            return;
        }

        $this->output->writeln(sprintf('Drop and create index for "<comment>%s</comment>" manager.', $name));
        $manager->dropAndCreateIndex();
    }
private function buildForManager(Manager $manager, $destroy)
    {
        $name = $manager->getName();
        if (!$manager->indexExists()) {
            $this->output->writeln(sprintf('Create index for "<comment>%s</comment>" manager.', $name));
            $manager->createIndex();

            return;
        }

        if (!$destroy) {
            return;
        }

        $this->output->writeln(sprintf('Drop and create index for "<comment>%s</comment>" manager.', $name));
        $manager->dropAndCreateIndex();
    }
private function buildForManager ( Manager $ manager , $ destroy ) { $ name = $ manager -> getName ( ) ; if ( ! $ manager -> indexExists ( ) ) { $ this -> output -> writeln ( sprintf ( 'Create index for "<comment>%s</comment>" manager.' , $ name ) ) ; $ manager -> createIndex ( ) ; return ; } if ( ! $ destroy ) { return ; } $ this -> output -> writeln ( sprintf ( 'Drop and create index for "<comment>%s</comment>" manager.' , $ name ) ) ; $ manager -> dropAndCreateIndex ( ) ; }
Build index for given manager.

If index not exists - it will be created.
If index exists and destroy flag is true - drop and create index.
Else do nothing.

@param Manager $manager
@param bool $destroy
Build index for given manager .