public function Index::getFields in Search API 8
Returns a list of all indexed fields of this index.
Parameters
bool $include_server_defined: (optional) If TRUE, also include special fields defined by the server backend. For more information, see \Drupal\search_api\Backend\BackendSpecificInterface::getBackendDefinedFields().
Return value
\Drupal\search_api\Item\FieldInterface[] An array of all indexed fields for this index, keyed by field identifier.
Overrides IndexInterface::getFields
7 calls to Index::getFields()
- Index::getDependencyData in src/
Entity/ Index.php - Retrieves data about this index's dependencies.
- Index::getField in src/
Entity/ Index.php - Returns a field from this index.
- Index::getFieldRenames in src/
Entity/ Index.php - Retrieves all field IDs that changed compared to the index's saved version.
- Index::getFieldsByDatasource in src/
Entity/ Index.php - Returns a list of all indexed fields of a specific datasource.
- Index::getFulltextFields in src/
Entity/ Index.php - Retrieves all of this index's fulltext fields.
File
- src/
Entity/ Index.php, line 754
Class
- Index
- Defines the search index configuration entity.
Namespace
Drupal\search_api\EntityCode
public function getFields($include_server_defined = FALSE) {
if (!isset($this->fieldInstances)) {
$this->fieldInstances = [];
foreach ($this->field_settings as $key => $field_info) {
$this->fieldInstances[$key] = \Drupal::getContainer()
->get('search_api.fields_helper')
->createField($this, $key, $field_info);
}
}
$fields = $this->fieldInstances;
if ($include_server_defined && $this
->hasValidServer()) {
$fields += $this
->getServerInstance()
->getBackendDefinedFields($this);
}
return $fields;
}