You are here

public function SearchApiSolrAcquiaConnector::getUpdateQuery in Acquia Connector 8

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 the Search API Server is currently in read-only mode.

File

acquia_search/src/Plugin/SolrConnector/SearchApiSolrAcquiaConnector.php, line 227

Class

SearchApiSolrAcquiaConnector
Acquia Search Plugin for Search API Solr.

Namespace

Drupal\acquia_search\Plugin\SolrConnector

Code

public function getUpdateQuery() {
  $this
    ->connect();
  $overridden = $this->solr
    ->getEndpoint('core')
    ->getOption('overridden_by_acquia_search');
  if ($overridden === ACQUIA_SEARCH_AUTO_OVERRIDE_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();
}