public function Server::getBackendDefinedFields in Search API 8
Provides information on additional fields made available by the backend.
If a backend indexes additional data with items and wants to make this available as fixed fields on the index (for example, to be used with Views), it can implement this method to facilitate this.
Fields returned here are expected to work correctly with this server when used in query conditions, sorts or similar places.
Parameters
\Drupal\search_api\IndexInterface $index: The index for which fields are being determined.
Return value
\Drupal\search_api\Item\FieldInterface[] An array of additional fields that are available for this index, keyed by their field IDs. The field IDs should always start with "search_api_" (avoiding the special field IDs defined by \Drupal\search_api\Query\QueryInterface::sort()) to avoid conflicts with user-defined fields.
Overrides BackendSpecificInterface::getBackendDefinedFields
File
- src/
Entity/ Server.php, line 251
Class
- Server
- Defines the search server configuration entity.
Namespace
Drupal\search_api\EntityCode
public function getBackendDefinedFields(IndexInterface $index) {
if ($this
->hasValidBackend()) {
return $this
->getBackend()
->getBackendDefinedFields($index);
}
return [];
}