public function optimize()
    {
        // Commit changes if any changes have been made
        $this->commit();

        if (count($this->_segmentInfos) > 1 || $this->hasDeletions()) {
            $this->_getIndexWriter()->optimize();
            $this->_updateDocCount();
        }
    }
public function optimize()
    {
        // Commit changes if any changes have been made
        $this->commit();

        if (count($this->_segmentInfos) > 1 || $this->hasDeletions()) {
            $this->_getIndexWriter()->optimize();
            $this->_updateDocCount();
        }
    }
public function optimize ( ) { // Commit changes if any changes have been made $ this -> commit ( ) ; if ( count ( $ this -> _segmentInfos ) > 1 || $ this -> hasDeletions ( ) ) { $ this -> _getIndexWriter ( ) -> optimize ( ) ; $ this -> _updateDocCount ( ) ; } }
Optimize index.

Merges all segments into one
Optimize index .