$mapping =
array_combine($keys,
$keys);
$hasOptionFilter =
$this->
hasOptionFilter($criteria);
if (!
$hasOptionFilter) { $mapping =
$this->
resolvePreviews($keys,
$context);
} $event =
new ProductListingResolvePreviewEvent($context,
$criteria,
$mapping,
$hasOptionFilter);
$this->eventDispatcher->
dispatch($event);
$mapping =
$event->
getMapping();
$read =
$criteria->
cloneForRead(array_values($mapping));
$read->
addAssociation('options.group'
);
$searchResult =
$this->productRepository->
search($read,
$context);
$this->
addExtensions($ids,
$searchResult,
$mapping);
$result =
new EntitySearchResult(ProductDefinition::ENTITY_NAME,
$ids->
getTotal(),
$searchResult->
getEntities(),
$aggregations,
$origin,
$context->
getContext());
$result->
addState(...
$ids->
getStates());
return $result;
}