Esempio n. 1
0
 public function testConfigMode()
 {
     $options = array('softcommit' => true, 'waitsearcher' => false, 'expungedeletes' => true);
     $command = new Commit($options);
     $this->assertEquals(true, $command->getSoftCommit());
     $this->assertEquals(false, $command->getWaitSearcher());
     $this->assertEquals(true, $command->getExpungeDeletes());
 }
Esempio n. 2
0
 /**
  * Convenience method to add a commit 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 $softCommit
  * @param boolean $waitSearcher
  * @param boolean $expungeDeletes
  *
  * @return self Provides fluent interface
  */
 public function addCommit($softCommit = null, $waitSearcher = null, $expungeDeletes = null)
 {
     $commit = new CommitCommand();
     if (null !== $softCommit) {
         $commit->setSoftCommit($softCommit);
     }
     if (null !== $waitSearcher) {
         $commit->setWaitSearcher($waitSearcher);
     }
     if (null !== $expungeDeletes) {
         $commit->setExpungeDeletes($expungeDeletes);
     }
     return $this->add(null, $commit);
 }
 /**
  * Build XML for a commit command
  *
  * @param  Query\Command\Commit $command
  * @return string
  */
 public function buildCommitXml($command)
 {
     $xml = '<commit';
     $xml .= $this->boolAttrib('softCommit', $command->getSoftCommit());
     $xml .= $this->boolAttrib('waitSearcher', $command->getWaitSearcher());
     $xml .= $this->boolAttrib('expungeDeletes', $command->getExpungeDeletes());
     $xml .= '/>';
     return $xml;
 }