Question

How to get product collection by full text search?

        $query = $this->queryFactory->get()->getQueryText();
        $collection = $this->_productCollectionFactory->create();

        $collection->addAttributeToFilter('name', array('like' => '%'.$query.'%'));
        $collection->setPageSize(10); // fetching only 10 products

Any one help in this?

Was it helpful?

Solution

Please check with below url :

https://mage2.pro/t/topic/1121

I hope its work for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top