public function SolrConnectorPluginBase::optimize in Search API Solr 8
Same name and namespace in other branches
- 8.3 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::optimize()
- 8.2 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::optimize()
- 4.x src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::optimize()
Optimizes the Solr index.
Parameters
\Solarium\Core\Client\Endpoint|null $endpoint:
Overrides SolrConnectorInterface::optimize
File
- src/
SolrConnector/ SolrConnectorPluginBase.php, line 897
Class
- SolrConnectorPluginBase
- Defines a base class for Solr connector plugins.
Namespace
Drupal\search_api_solr\SolrConnectorCode
public function optimize(Endpoint $endpoint = NULL) {
$this
->connect();
if (!$endpoint) {
$endpoint = $this->solr
->getEndpoint('core');
}
// The default timeout is set for search queries. The configured timeout
// might differ and needs to be set now because solarium doesn't
// distinguish between these types.
$this
->useTimeout(self::OPTIMIZE_TIMEOUT, $endpoint);
$update_query = $this->solr
->createUpdate();
$update_query
->addOptimize(TRUE, FALSE);
$this
->execute($update_query, $endpoint);
}