You are here

public function IndexInterface::addField in Search API 8

Adds a field to this index.

Parameters

\Drupal\search_api\Item\FieldInterface $field: The field to add.

Return value

$this

Throws

\Drupal\search_api\SearchApiException Thrown if the field could not be added, either because a field with the same field ID already exists, or because the field identifier is one of the reserved field IDs of pseudo-fields that can be used in search queries.

2 methods override IndexInterface::addField()
Index::addField in src/Entity/Index.php
Adds a field to this index.
UnsavedIndexConfiguration::addField in src/UnsavedIndexConfiguration.php
Adds a field to this index.

File

src/IndexInterface.php, line 426

Class

IndexInterface
Defines the interface for index entities.

Namespace

Drupal\search_api

Code

public function addField(FieldInterface $field);