original_string: 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();
          }
      }
code: 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();
          }
      }
code_tokens: 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 ( ) ; } }
docstring: Optimize index.
  
  Merges all segments into one
docstring_tokens: Optimize index .