/**
* @throws InconsistentCriteriaIdsException
*
* @return EntitySearchResult<TEntityCollection>
*/
public function search(Criteria
$criteria, SalesChannelContext
$salesChannelContext): EntitySearchResult
{ $criteria =
clone $criteria;
$this->
processCriteria($criteria,
$salesChannelContext);
$aggregations = null;
if ($criteria->
getAggregations()) { $aggregations =
$this->
aggregate($criteria,
$salesChannelContext);
} if (!RepositorySearchDetector::
isSearchRequired($this->definition,
$criteria)) { $entities =
$this->
read($criteria,
$salesChannelContext);
return new EntitySearchResult($this->definition->
getEntityName(),
$entities->
count(),
$entities,
$aggregations,
$criteria,
$salesChannelContext->
getContext());
}