You are here

protected function Denormalize::createDocument in Search API Grouping 8

Create a denormalized item for indexing.

Parameters

\Drupal\search_api\Item\Item $item: The item to index.

string $field_name: The field name.

mixed $value: The value of the field.

Return value

\Drupal\search_api\Item\Item Denormalized item to index.

1 call to Denormalize::createDocument()
Denormalize::alterIndexedItems in src/Plugin/search_api/processor/Denormalize.php
Alter the items to be indexed.

File

src/Plugin/search_api/processor/Denormalize.php, line 187

Class

Denormalize
This processor allows you to denormalize items.

Namespace

Drupal\search_api_grouping\Plugin\search_api\processor

Code

protected function createDocument(Item $item, $field_name, $value) {
  $item = clone $item;
  $item
    ->getField($field_name)
    ->setValues([
    $value,
  ]);
  return $item;
}