You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to find a "nice" way to enrich a document with additional data from other data sources, so the first spot to look at was the ongr_filter_manager.search_response event.
class EsSearchResponseListener
{
/** @var SearchIndexerInterface */
private $indexer;
public function __construct(SearchIndexerInterface $indexer)
{
$this->indexer = $indexer;
}
public function onOngrfiltermanagerSearchresponse(SearchResponseEvent $event)
{
$documents = $event->getDocumentIterator();
$config = $this->indexer->getConfig();
foreach ($documents as $document) {
if (!$document instanceof TypedContent) {
continue;
}
if (
!in_array(get_class($document), array_keys($config))
|| !in_array($document->getType(), array_keys($config[get_class($document)]))
) {
continue;
}
$conf = $config[get_class($document)][$document->getType()];
/** @var ObjectRepository $repository */
$repository = $conf['repository'];
$obj = $repository->findOneBy([
$config['identifier'] => $document->getId()
]);
$document->setDataObject($obj);
}
}
}
it was only after I wrote this, that I realized that the entries for the the results are not changed outside of the listeners scope.
What would be a good way to achieve something like this?
Are there maybe any events fired when the results are converted from their raw form to the document object?
The text was updated successfully, but these errors were encountered:
Hello there,
I was trying to find a "nice" way to enrich a document with additional data from other data sources, so the first spot to look at was the
ongr_filter_manager.search_response
event.it was only after I wrote this, that I realized that the entries for the the results are not changed outside of the listeners scope.
What would be a good way to achieve something like this?
Are there maybe any events fired when the results are converted from their raw form to the document object?
The text was updated successfully, but these errors were encountered: