protected function SolrFieldManager::buildFieldDefinitionsFromConfig in Search API Solr 8.3
Same name and namespace in other branches
- 4.x src/SolrFieldManager.php \Drupal\search_api_solr\SolrFieldManager::buildFieldDefinitionsFromConfig()
Builds the field definitions from exiting index config.
Parameters
\Drupal\search_api\IndexInterface $index: The index from which we are retrieving field information.
Return value
\Drupal\Core\TypedData\DataDefinitionInterface[] The array of field definitions for the server, keyed by field name.
Throws
\Drupal\search_api\SearchApiException
1 call to SolrFieldManager::buildFieldDefinitionsFromConfig()
- SolrFieldManager::buildFieldDefinitions in src/
SolrFieldManager.php - Builds the field definitions for a Solr server.
File
- src/
SolrFieldManager.php, line 132
Class
- SolrFieldManager
- Manages the discovery of Solr fields.
Namespace
Drupal\search_api_solrCode
protected function buildFieldDefinitionsFromConfig(IndexInterface $index) {
$fields = [];
foreach ($index
->getFields() as $index_field) {
$solr_field = $index_field
->getPropertyPath();
$field = new SolrFieldDefinition([
'schema' => '',
]);
$field
->setLabel($index_field
->getLabel());
$field
->setDataType($index_field
->getType());
$fields[$solr_field] = $field;
}
return $fields;
}