You are here

public function StandardSolrCloudConnector::deleteCheckpoints in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/SolrConnector/StandardSolrCloudConnector.php \Drupal\search_api_solr\Plugin\SolrConnector\StandardSolrCloudConnector::deleteCheckpoints()

Deletes all checkpoints for given index/site.

Parameters

string $index_id: Id of the index.

string $site_hash: The site hash.

Throws

\Drupal\search_api_solr\SearchApiSolrException

Overrides SolrCloudConnectorInterface::deleteCheckpoints

File

src/Plugin/SolrConnector/StandardSolrCloudConnector.php, line 172

Class

StandardSolrCloudConnector
Standard Solr Cloud connector.

Namespace

Drupal\search_api_solr\Plugin\SolrConnector

Code

public function deleteCheckpoints(string $index_id, string $site_hash) {
  if ($checkpoints_collection_endpoint = $this
    ->getCheckpointsCollectionEndpoint()) {
    $update_query = $this
      ->getUpdateQuery();

    // id:/.*-INDEX_ID-SITE_HASH/ is a regex.
    $update_query
      ->addDeleteQuery('id:/' . Utility::formatCheckpointId('.*', $index_id, $site_hash) . '/');
    $this
      ->update($update_query, $checkpoints_collection_endpoint);
  }
}