You are here

public function StandardSolrCloudConnector::getStatsSummary in Search API Solr 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/SolrConnector/StandardSolrCloudConnector.php \Drupal\search_api_solr\Plugin\SolrConnector\StandardSolrCloudConnector::getStatsSummary()
  2. 4.x src/Plugin/SolrConnector/StandardSolrCloudConnector.php \Drupal\search_api_solr\Plugin\SolrConnector\StandardSolrCloudConnector::getStatsSummary()

Gets summary information about the Solr Core.

Return value

array An array of stats about the solr core.

Throws

\Drupal\search_api_solr\SearchApiSolrException

Overrides SolrConnectorPluginBase::getStatsSummary

File

src/Plugin/SolrConnector/StandardSolrCloudConnector.php, line 46

Class

StandardSolrCloudConnector
Standard Solr Cloud connector.

Namespace

Drupal\search_api_solr\Plugin\SolrConnector

Code

public function getStatsSummary() {
  $summary = parent::getStatsSummary();
  $summary['@collection_name'] = '';
  $query = $this->solr
    ->createPing();
  $query
    ->setResponseWriter(PingQuery::WT_PHPS);
  $query
    ->setHandler('admin/mbeans?stats=true');
  $stats = $this
    ->execute($query)
    ->getData();
  if (!empty($stats)) {
    $solr_version = $this
      ->getSolrVersion(TRUE);
    if (version_compare($solr_version, '7.0', '>=')) {
      $summary['@collection_name'] = $stats['solr-mbeans']['CORE']['core']['stats']['CORE.collection'];
    }
    else {
      $summary['@core_name'] = $stats['solr-mbeans']['CORE']['core']['stats']['collection'];
    }
  }
  return $summary;
}