/**
* @param \GraphAware\Common\Type\NodeInterface $input
* @param \GraphAware\Reco4PHP\Engine\DiscoveryEngine[] $engines
*
* @return \GraphAware\Common\Result\ResultCollection
*/
public function processDiscovery(NodeInterface $input, array $engines)
{
$stack = $this->databaseService->getDriver()->stack();
foreach ($engines as $engine) {
$statement = $engine->discoveryQuery($input);
$stack->push($statement->text(), $statement->parameters(), $engine->name());
}
try {
$resultCollection = $this->databaseService->getDriver()->runStack($stack);
return $resultCollection;
} catch (\Exception $e) {
throw new \RuntimeException($e->getMessage());
}
}