You are here

public function AbstractSearchApiSolrMultilingualBackend::getSchemaLanguageStatistics in Search API Multilingual Solr Search 8

Gets schema language statistics for the multilingual Solr server.

Return value

array Stats as associative array keyed by language IDs and a boolean value to indicate if corresponding field types are existing on the server's current schema.

Overrides SolrMultilingualBackendInterface::getSchemaLanguageStatistics

File

src/Plugin/search_api/backend/AbstractSearchApiSolrMultilingualBackend.php, line 505

Class

AbstractSearchApiSolrMultilingualBackend
A abstract base class for all multilingual Solr Search API backends.

Namespace

Drupal\search_api_solr_multilingual\Plugin\search_api\backend

Code

public function getSchemaLanguageStatistics() {
  $available = $this
    ->getSolrConnector()
    ->pingCore();
  $stats = [];
  foreach (\Drupal::languageManager()
    ->getLanguages() as $language) {
    $solr_field_type_name = SearchApiSolrUtility::encodeSolrName('text' . '_' . $language
      ->getId());
    $stats[$language
      ->getId()] = $available ? $this
      ->isPartOfSchema('fieldTypes', $solr_field_type_name) : FALSE;
  }
  return $stats;
}