示例#1
0
 /**
  * Convenience method to add an optimize command
  *
  * If you need more control, like choosing a key for the command you need to
  * create you own command instance and use the add method.
  *
  * @param boolean $waitFlush
  * @param boolean $waitSearcher
  * @param int $maxSegments
  * @return Solarium_Query_Update Provides fluent interface
  */
 public function addOptimize($waitFlush = null, $waitSearcher = null, $maxSegments = null)
 {
     $optimize = new Solarium_Query_Update_Command_Optimize();
     if (null !== $waitFlush) {
         $optimize->setWaitFlush($waitFlush);
     }
     if (null !== $waitSearcher) {
         $optimize->setWaitSearcher($waitSearcher);
     }
     if (null !== $maxSegments) {
         $optimize->setMaxSegments($maxSegments);
     }
     return $this->add(null, $optimize);
 }