You are here

public function Index::setFields in Search API 8

Sets this index's fields.

Usually, it's a better idea to add/rename/remove fields individually with the above methods. Use this method only if this is for some reason not easily possible (such as when renaming multiple fields at once might cause conflicts).

Parameters

\Drupal\search_api\Item\FieldInterface[] $fields: An array of fields for this index, keyed by field IDs.

Return value

$this

Overrides IndexInterface::setFields

File

src/Entity/Index.php, line 747

Class

Index
Defines the search index configuration entity.

Namespace

Drupal\search_api\Entity

Code

public function setFields(array $fields) {
  $this->fieldInstances = $fields;
}