You are here

public function Apache_Solr_Service::optimize in Apache Solr Search 5

Send an optimize command. Will be synchronous unless both wait parameters are set to false.

Parameters

boolean $waitFlush:

boolean $waitSearcher:

float $timeout Maximum expected duration of the commit operation on the server (otherwise, will throw a communication exception):

Return value

Apache_Solr_Response

Throws

Exception If an error occurs during the service call

File

SolrPhpClient/Apache/Solr/Service.php, line 833

Class

Apache_Solr_Service
Starting point for the Solr API. Represents a Solr server resource and has methods for pinging, adding, deleting, committing, optimizing and searching.

Code

public function optimize($waitFlush = true, $waitSearcher = true, $timeout = 3600) {
  $flushValue = $waitFlush ? 'true' : 'false';
  $searcherValue = $waitSearcher ? 'true' : 'false';
  $rawPost = '<optimize waitFlush="' . $flushValue . '" waitSearcher="' . $searcherValue . '" />';
  return $this
    ->_sendRawPost($this->_updateUrl, $rawPost, $timeout);
}