public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $productCollection = $observer->getEvent()->getData('product_collection');
        $storeId           = $observer->getEvent()->getData('store_id');

        if (($productCollection instanceof \Magento\Catalog\Model\ResourceModel\Product\Collection) && $storeId) {
            $this->logEvent($productCollection, $storeId);
        }
    }
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $productCollection = $observer->getEvent()->getData('product_collection');
        $storeId           = $observer->getEvent()->getData('store_id');

        if (($productCollection instanceof \Magento\Catalog\Model\ResourceModel\Product\Collection) && $storeId) {
            $this->logEvent($productCollection, $storeId);
        }
    }
public function execute ( \ Magento \ Framework \ Event \ Observer $ observer ) { $ productCollection = $ observer -> getEvent ( ) -> getData ( 'product_collection' ) ; $ storeId = $ observer -> getEvent ( ) -> getData ( 'store_id' ) ; if ( ( $ productCollection instanceof \ Magento \ Catalog \ Model \ ResourceModel \ Product \ Collection ) && $ storeId ) { $ this -> logEvent ( $ productCollection , $ storeId ) ; } }
Logs a fulltext search event before the user is redirected to the product page.

@SuppressWarnings(PHPMD.UnusedFormalParameter)

@event elasticsuite_redirect_if_one_result

@param \Magento\Framework\Event\Observer $observer The observer

@return void
Logs a fulltext search event before the user is redirected to the product page .