You are here

function elasticsearch_connector_search_api_search_api_service_info in Elasticsearch Connector 7.2

Same name and namespace in other branches
  1. 7.5 modules/elasticsearch_connector_search_api/elasticsearch_connector_search_api.module \elasticsearch_connector_search_api_search_api_service_info()
  2. 7 modules/elasticsearch_connector_search_api/elasticsearch_connector_search_api.module \elasticsearch_connector_search_api_search_api_service_info()

Implements hook_search_api_service_info().

File

modules/elasticsearch_connector_search_api/elasticsearch_connector_search_api.module, line 10
Provides a elasticsearch-based service class for the Search API.

Code

function elasticsearch_connector_search_api_search_api_service_info() {
  $services = array();
  $services['search_api_elasticsearch_connector'] = array(
    'name' => t('Elasticsearch Connector service'),
    'description' => t('
    <p>Index items using a !url_elasticsearch search server.</p>
    <ul>
    <li>All field types are supported.</li>
    <li>Search API facets are supported.</li>
    <li>Will use internal elasticsearch preprocessors, so Search API preprocessors should for the most part be deactivated.</li>
    <li>See the README.txt file provided with this module for details.</li>
    </ul>', array(
      // Use directly the <a> tag because l() function break the building at some point.
      '!url_elasticsearch' => '<a href="' . url('http://www.elasticsearch.org/') . '">' . t('Elasticsearch') . '</a>',
    )),
    'class' => 'SearchApiElasticsearchConnector',
  );

  // If the ElasticSearch library isn't available, use a dummy service class.
  if (!class_exists('\\nodespark\\DESConnector\\ClientFactory') && module_exists('composer_manager')) {

    // When using search_api_autocomplete the composer manager doesn't handle the class loading.
    // This can be an issue with composer manager and should be checked.
    composer_manager_register_autoloader();
    if (!class_exists('\\nodespark\\DESConnector\\ClientFactory')) {
      $services['search_api_elasticsearch_connector']['class'] = 'SearchApiElasticsearchConnectorMissing';
    }
  }
  return $services;
}