You are here

public function SearchApiSolrAcquiaConnector::getUpdateQuery in Acquia Search 3.x

Same name and namespace in other branches
  1. 2.x src/Plugin/SolrConnector/SearchApiSolrAcquiaConnector.php \Drupal\acquia_search\Plugin\SolrConnector\SearchApiSolrAcquiaConnector::getUpdateQuery()

Avoid providing an valid Update query if module determines this server should be locked down (as indicated by the overridden_by_acquia_search server option).

Throws

\Exception If this index in read-only mode.

Overrides SolrConnectorPluginBase::getUpdateQuery

File

src/Plugin/SolrConnector/SearchApiSolrAcquiaConnector.php, line 399

Class

SearchApiSolrAcquiaConnector
Class SearchApiSolrAcquiaConnector.

Namespace

Drupal\acquia_search\Plugin\SolrConnector

Code

public function getUpdateQuery() {
  $this
    ->connect();
  $overridden = $this->solr
    ->getEndpoint(self::ENDPOINT_KEY)
    ->getOption('overridden_by_acquia_search');
  if ($overridden === SearchApiSolrAcquiaConnector::READ_ONLY) {
    $message = 'The Search API Server serving this index is currently in read-only mode.';
    \Drupal::logger('acquia_search')
      ->error($message);
    throw new \Exception($message);
  }
  return $this->solr
    ->createUpdate();
}