You are here

protected function SearchApiElasticsearchConnector::checkClient in Elasticsearch Connector 7.5

Same name and namespace in other branches
  1. 7 modules/elasticsearch_connector_search_api/service.inc \SearchApiElasticsearchConnector::checkClient()
  2. 7.2 modules/elasticsearch_connector_search_api/service.inc \SearchApiElasticsearchConnector::checkClient()
1 call to SearchApiElasticsearchConnector::checkClient()
SearchApiElasticsearchConnector::search in modules/elasticsearch_connector_search_api/service.inc
Overrides search().

File

modules/elasticsearch_connector_search_api/service.inc, line 607
Provides a Elasticsearch-based service class for the Search API using Elasticsearch Connector module.

Class

SearchApiElasticsearchConnector
Search service class.

Code

protected function checkClient($throwError = FALSE) {
  if (empty($this->elasticsearchClient) || !$this->elasticsearchClient instanceof \nodespark\DESConnector\ClientInterface) {
    if ($throwError) {
      throw new SearchApiElasticsearchConnectorException(t('Elasticsearch library hasn\'t been initialized successfully.'));
    }
    else {
      return FALSE;
    }
  }
  else {
    return TRUE;
  }
}