public static function Utility::hasIndexSolrDatasources in Search API Solr 4.x
Same name and namespace in other branches
- 8.3 src/Utility/Utility.php \Drupal\search_api_solr\Utility\Utility::hasIndexSolrDatasources()
Returns whether the index contains any "solr_*" datasources.
Parameters
\Drupal\search_api\IndexInterface $index: The Search API index entity.
Return value
bool TRUE if the index contains "solr_*" datasources, FALSE otherwise.
1 call to Utility::hasIndexSolrDatasources()
- SolrDocumentDeriver::getDerivativeDefinitions in src/
Plugin/ DataType/ Deriver/ SolrDocumentDeriver.php
File
- src/
Utility/ Utility.php, line 1003
Class
- Utility
- Provides various helper functions for Solr backends.
Namespace
Drupal\search_api_solr\UtilityCode
public static function hasIndexSolrDatasources(IndexInterface $index) : bool {
static $datasources = [];
if (!isset($datasources[$index
->id()])) {
$datasource_ids = $index
->getDatasourceIds();
$datasource_ids = array_filter($datasource_ids, function ($datasource_id) {
return strpos($datasource_id, 'solr_') === 0;
});
$datasources[$index
->id()] = !empty($datasource_ids);
}
return $datasources[$index
->id()];
}