<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Finalizes all add/deletes made to the index</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="solrclient.adddocuments.html">SolrClient::addDocuments</a></div> <div class="next" style="text-align: right; float: right;"><a href="solrclient.construct.html">SolrClient::__construct</a></div> <div class="up"><a href="class.solrclient.html">SolrClient</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="solrclient.commit" class="refentry"> <div class="refnamediv"> <h1 class="refname">SolrClient::commit</h1> <p class="verinfo">(PECL solr >= 0.9.2)</p><p class="refpurpose"><span class="refname">SolrClient::commit</span> — <span class="dc-title">Finalizes all add/deletes made to the index</span></p> </div> <div class="refsect1 description" id="refsect1-solrclient.commit-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type"><a href="class.solrupdateresponse.html" class="type SolrUpdateResponse">SolrUpdateResponse</a></span> <span class="methodname"><strong>SolrClient::commit</strong></span> ([ <span class="methodparam"><span class="type">bool</span> <code class="parameter">$softCommit</code><span class="initializer"> = <strong><code>FALSE</code></strong></span></span> [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$waitSearcher</code><span class="initializer"> = <strong><code>TRUE</code></strong></span></span> [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$expungeDeletes</code><span class="initializer"> = <strong><code>FALSE</code></strong></span></span> ]]] )</div> <p class="para rdfs-comment"> This method finalizes all add/deletes made to the index. </p> </div> <div class="refsect1 parameters" id="refsect1-solrclient.commit-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <code class="parameter">softCommit</code></dt> <dd> <p class="para"> This will refresh the 'view' of the index in a more performant manner, but without "on-disk" guarantees. (Solr4.0+) </p> <p class="para"> A soft commit is much faster since it only makes index changes visible and does not fsync index files or write a new index descriptor. If the JVM crashes or there is a loss of power, changes that occurred after the last hard commit will be lost. Search collections that have near-real-time requirements (that want index changes to be quickly visible to searches) will want to soft commit often but hard commit less frequently. </p> </dd> <dt> <code class="parameter">waitSearcher</code></dt> <dd> <p class="para"> block until a new searcher is opened and registered as the main query searcher, making the changes visible. </p> </dd> <dt> <code class="parameter">expungeDeletes</code></dt> <dd> <p class="para"> Merge segments with deletes away. (Solr1.4+) </p> </dd> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-solrclient.commit-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns a <a href="class.solrupdateresponse.html" class="classname">SolrUpdateResponse</a> object on success or throws an exception on failure. </p> </div> <div class="refsect1 errors" id="refsect1-solrclient.commit-errors"> <h3 class="title">Errors/Exceptions</h3> <p class="para"> Throws <a href="class.solrclientexception.html" class="classname">SolrClientException</a> if the client had failed, or there was a connection issue. </p> <p class="para"> Throws <a href="class.solrserverexception.html" class="classname">SolrServerException</a> if the Solr Server had failed to process the request. </p> </div> <div class="refsect1 changelog" id="refsect1-solrclient.commit-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>1.1.0, 2.0.0</td> <td> $maxSegments removed </td> </tr> <tr> <td>2.0.0b</td> <td> API Changed: SolrClient::commit ([ int $maxSegments = 0 [, bool $softCommit = false [, bool $waitSearcher = true[, bool $expungeDeletes = false ]]] ) </td> </tr> <tr> <td>0.9.2</td> <td> Signature: SolrClient::commit ([ int $maxSegments = 1 [, bool $waitFlush = true [, bool $waitSearcher = true ]]] ). $waitFlush: Block until index changes are flushed to disk. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 notes" id="refsect1-solrclient.commit-notes"> <h3 class="title">Notes</h3> <div class="warning"><strong class="warning">Warning</strong> <p class="para"> PECL Solr >= 2.0 only supports Solr Server >= 4.0 </p> </div> </div> <div class="refsect1 seealso" id="refsect1-solrclient.commit-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><span class="methodname"><a href="solrclient.optimize.html" class="methodname" rel="rdfs-seeAlso">SolrClient::optimize()</a> - Defragments the index</span></li> <li class="member"><span class="methodname"><a href="solrclient.rollback.html" class="methodname" rel="rdfs-seeAlso">SolrClient::rollback()</a> - Rollbacks all add/deletes made to the index since the last commit</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="solrclient.adddocuments.html">SolrClient::addDocuments</a></div> <div class="next" style="text-align: right; float: right;"><a href="solrclient.construct.html">SolrClient::__construct</a></div> <div class="up"><a href="class.solrclient.html">SolrClient</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>