public function onIndexRebuild(IndexRebuildEvent $event)
    {
        foreach ($this->adapter->listIndexes() as $indexName) {
            if (!$this->indexNameDecorator->isVariant($this->indexNameDecorator->undecorate($indexName), $indexName)) {
                continue;
            }

            $event->getOutput()->writeln(sprintf('<info>Optimizing zend lucene index:</info> %s', $indexName));
            $this->adapter->optimize($indexName);
        }
    }
public function onIndexRebuild(IndexRebuildEvent $event)
    {
        foreach ($this->adapter->listIndexes() as $indexName) {
            if (!$this->indexNameDecorator->isVariant($this->indexNameDecorator->undecorate($indexName), $indexName)) {
                continue;
            }

            $event->getOutput()->writeln(sprintf('<info>Optimizing zend lucene index:</info> %s', $indexName));
            $this->adapter->optimize($indexName);
        }
    }
public function onIndexRebuild ( IndexRebuildEvent $ event ) { foreach ( $ this -> adapter -> listIndexes ( ) as $ indexName ) { if ( ! $ this -> indexNameDecorator -> isVariant ( $ this -> indexNameDecorator -> undecorate ( $ indexName ) , $ indexName ) ) { continue ; } $ event -> getOutput ( ) -> writeln ( sprintf ( '<info>Optimizing zend lucene index:</info> %s' , $ indexName ) ) ; $ this -> adapter -> optimize ( $ indexName ) ; } }
Optimize the search indexes after the index rebuild event has been fired.
Should have a priority low enough in order for it to be executed after all
the actual index builders.

@param IndexRebuildEvent $event
Optimize the search indexes after the index rebuild event has been fired . Should have a priority low enough in order for it to be executed after all the actual index builders .