<?php declare(strict_types=1);
namespace Swag\EnterpriseSearch\IndexingQuery;
use Swag\EnterpriseSearch\Boosting\BoostingCollection;
use Swag\EnterpriseSearch\Boosting\BoostingEntity;
use Swag\EnterpriseSearch\Relevance\RelevanceBluePrintCollection;
use Swag\EnterpriseSearch\Relevance\RelevanceBluePrintEntity;
class IndexingQueryGateway
{
public function fromJsonToBoostingCollection(array $boostingJson): BoostingCollection
{
$boostingCollection = new BoostingCollection();
foreach ($boostingJson as $boostingEntry) {
$boosting = new BoostingEntity();
$boosting->assign($boostingEntry);
$boostingCollection->add($boosting);
}
return $boostingCollection;
}
public function fromJsonToRelevanceCollection(array $relevanceJson): RelevanceBluePrintCollection
{
$relevanceCollection = new RelevanceBluePrintCollection();
foreach ($relevanceJson as $relevanceEntry) {
$relevance = new RelevanceBluePrintEntity();
$relevance->assign($relevanceEntry);
$relevanceCollection->add($relevance);
}
return $relevanceCollection;
}
}