public final function handleResultSet(Node $input, Result $result, Recommendations $recommendations)
{
$recordsMap = [];
foreach ($result->records() as $i => $record) {
if (!$record->hasValue($this->idResultName())) {
throw new \InvalidArgumentException(sprintf('The record does not contain a value with key "%s" in "%s"', $this->idResultName(), $this->name()));
}
$recordsMap[$record->get($this->idResultName())] = $record;
}
foreach ($recommendations->getItems() as $recommendation) {
if (array_key_exists($recommendation->item()->identity(), $recordsMap)) {
$this->postProcess($input, $recommendation, $recordsMap[$recommendation->item()->identity()]);
}
}
}