You are here

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

Same name and namespace in other branches
  1. 3.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 the Search API Server is currently in read-only mode.

Overrides SolrConnectorPluginBase::getUpdateQuery

File

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

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();
}