You are here

public function SearchApiSolrBackend::isAvailable in Search API Solr 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::isAvailable()
  2. 8.2 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::isAvailable()
  3. 4.x src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::isAvailable()

Returns a boolean with the availability of the backend.

This can implement a specific call to test if the backend is available for reading. For SOLR or elasticsearch this would be a "ping" to the server to test if it's online. If this is a db-backend that is running on a separate server, this can also be a ping. When it's a db-backend that runs in the same database as the drupal installation; just returning TRUE is enough.

Return value

bool The availability of the backend.

Overrides BackendPluginBase::isAvailable

File

src/Plugin/search_api/backend/SearchApiSolrBackend.php, line 450

Class

SearchApiSolrBackend
Apache Solr backend for search api.

Namespace

Drupal\search_api_solr\Plugin\search_api\backend

Code

public function isAvailable() {
  $conn = $this
    ->getSolrConnector();
  return $conn
    ->pingCore() !== FALSE;
}