You are here

public function Field::getIndex in Search API 8

Returns the index of this field.

Return value

\Drupal\search_api\IndexInterface The index to which this field belongs.

Overrides FieldInterface::getIndex

File

src/Item/Field.php, line 243

Class

Field
Represents a field on a search item that can be indexed.

Namespace

Drupal\search_api\Item

Code

public function getIndex() {
  if (!$this->index && $this->indexId !== NULL) {
    $this->index = $this
      ->getEntityTypeManager()
      ->getStorage('search_api_index')
      ->load($this->indexId);
    $this->indexId = NULL;
  }
  return $this->index;
}