You are here

public function ResultSet::setExtraData in Search API 8

Sets some extra data for this search result.

Parameters

string $key: The key for the extra data.

mixed $data: (optional) The data to set. If NULL, remove the extra data with the given key instead.

Return value

$this

Overrides ResultSetInterface::setExtraData

File

src/Query/ResultSet.php, line 205

Class

ResultSet
Represents the result set of a search query.

Namespace

Drupal\search_api\Query

Code

public function setExtraData($key, $data = NULL) {
  if ($data !== NULL) {
    $this->extraData[$key] = $data;
  }
  else {
    unset($this->extraData[$key]);
  }
  return $this;
}