public function SearchApiSolrAcquiaConnector::defaultConfiguration in Acquia Connector 8
File
- acquia_search/
src/ Plugin/ SolrConnector/ SearchApiSolrAcquiaConnector.php, line 51
Class
- SearchApiSolrAcquiaConnector
- Acquia Search Plugin for Search API Solr.
Namespace
Drupal\acquia_search\Plugin\SolrConnectorCode
public function defaultConfiguration() {
$configuration = parent::defaultConfiguration();
$storage = new Storage();
$configuration['index_id'] = $storage
->getIdentifier();
$configuration['path'] = '/';
$configuration['host'] = acquia_search_get_search_host();
$configuration['scheme'] = empty($configuration['scheme']) ? 'http' : $configuration['scheme'];
$default_port = $configuration['scheme'] == 'https' ? 443 : 80;
$configuration['port'] = empty($configuration['port']) ? $default_port : $configuration['port'];
unset($configuration['overridden_by_acquia_search']);
// If auto-switch feature is turned off - do not attempt to determine the
// preferred core.
if (acquia_search_is_auto_switch_disabled()) {
return $configuration;
}
// If the search config is overridden in settings.php, apply this config
// to the Solr connection and don't attempt to determine the preferred
// core.
if (acquia_search_is_connection_config_overridden()) {
$configuration = $this
->setOverriddenCore($configuration);
return $configuration;
}
$preferred_core_service = acquia_search_get_core_service();
// If the preferred core available, set it.
if ($preferred_core_service
->isPreferredCoreAvailable()) {
$configuration = $this
->setPreferredCore($configuration, $preferred_core_service);
}
else {
// This means we can't detect which search core should be used, so we
// need to protect it by setting read-only mode but only if it applies.
if (acquia_search_should_set_read_only_mode()) {
$configuration = $this
->setReadOnlyMode($configuration);
}
}
return $configuration;
}