You are here

public static function Utility::hasIndexJustSolrDatasources in Search API Solr 8.3

Same name and namespace in other branches
  1. 4.x src/Utility/Utility.php \Drupal\search_api_solr\Utility\Utility::hasIndexJustSolrDatasources()

Returns whether the index only contains "solr_*" datasources.

Parameters

\Drupal\search_api\IndexInterface $index: The Search API index entity.

Return value

bool TRUE if the index only contains "solr_*" datasources, FALSE otherwise.

4 calls to Utility::hasIndexJustSolrDatasources()
SearchApiSolrBackend::extractResults in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Extract results from a Solr response.
SearchApiSolrBackend::formatSolrFieldNames in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Returns a language-specific mapping from Drupal to Solr field names.
SearchApiSolrBackend::getMoreLikeThisQuery in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Changes the query to a "More Like This" query.
SearchApiSolrBackend::hasIndexJustSolrDatasources in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Returns whether the index only contains "solr_*" datasources.

File

src/Utility/Utility.php, line 925

Class

Utility
Provides various helper functions for Solr backends.

Namespace

Drupal\search_api_solr\Utility

Code

public static function hasIndexJustSolrDatasources(IndexInterface $index) : bool {
  $datasource_ids = $index
    ->getDatasourceIds();
  $datasource_ids = array_filter($datasource_ids, function ($datasource_id) {
    return strpos($datasource_id, 'solr_') !== 0;
  });
  return !$datasource_ids;
}