public function testConfigMode() { $options = array('waitflush' => true, 'waitsearcher' => false, 'maxsegments' => 6); $command = new Solarium_Query_Update_Command_Optimize($options); $this->assertEquals(true, $command->getWaitFlush()); $this->assertEquals(false, $command->getWaitSearcher()); $this->assertEquals(6, $command->getMaxSegments()); }
/** * Build XML for an update command * * @param Solarium_Query_Update_Command_Optimize $command * @return string */ public function buildOptimizeXml($command) { $xml = '<optimize'; $xml .= $this->boolAttrib('waitFlush', $command->getWaitFlush()); $xml .= $this->boolAttrib('waitSearcher', $command->getWaitSearcher()); $xml .= $this->attrib('maxSegments', $command->getMaxSegments()); $xml .= '/>'; return $xml; }
/** * 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); }