public function getRecommendationsFromResult(NodeInterface $input, ResultCollection $resultCollection, DiscoveryEngine $engine, Recommendations $recommendations)
 {
     $result = $resultCollection->get($engine->name());
     foreach ($result->records() as $record) {
         $recommendations->add($record->value('reco'), new Score($engine->buildScore($input, $record->value($engine->recoResultName()), $record)));
     }
 }
 public final function produceRecommendations(NodeInterface $input, ResultCollection $resultCollection)
 {
     $result = $resultCollection->get($this->name());
     $recommendations = new Recommendations($this->name());
     foreach ($result->records() as $record) {
         if ($record->hasValue($this->recoResultName())) {
             $recommendations->add($record->value($this->recoResultName()), $this->name(), $this->buildScore($input, $record->value($this->recoResultName()), $record));
         }
     }
     return $recommendations;
 }
 private function buildBlacklistedNodes(ResultCollection $result, RecommendationEngine $engine)
 {
     $set = [];
     foreach ($engine->getBlacklistBuilders() as $blacklist) {
         $res = $result->get($blacklist->name());
         foreach ($res->records() as $record) {
             if ($record->hasValue($blacklist->itemResultName())) {
                 $node = $record->get($blacklist->itemResultName());
                 if ($node instanceof Node) {
                     $set[$node->identity()] = $node;
                 }
             }
         }
     }
     return $set;
 }