You are here

public function ItemInterface::getExtraData in Search API 8

Retrieves extra data for this item.

Parameters

string $key: The key of the extra data. The following keys are used in the Search API project itself:

  • highlighted_fields: Contains highlighted fields data for the result. The structure is an array, keyed by field IDs, mapped to arrays of values for that field. If possible, the array for a field with highlighting data should also include any non-highlighted field values, to avoid having to determine which values are included and which aren't.
  • highlighted_keys: The exact tokens that matched keys in this item's text values. The value is an array of strings.

However, contrib modules can define arbitrary other keys. (Usually they should be prefixed with the module name, though.)

mixed $default: (optional) The value to return if the data is not set.

Return value

mixed The data set for that key, or $default if the data is not present.

1 method overrides ItemInterface::getExtraData()
Item::getExtraData in src/Item/Item.php
Retrieves extra data for this item.

File

src/Item/ItemInterface.php, line 266

Class

ItemInterface
Represents a search item being indexed or returned as a search result.

Namespace

Drupal\search_api\Item

Code

public function getExtraData($key, $default = NULL);