0

I have written the plugin below but I can't seem to get it triggered.

<?php

namespace Vendor\ExtendedQuickSearch\Plugin;

use Magento\Framework\Search\Adapter\Mysql\Query\Builder\Match;

class QuickSearch
{
    public function beforeGetMatchQuery(
        \Magento\Framework\DB\Helper\Mysql\Fulltext $subject,
        $columns, $expression, $mode = self::FULLTEXT_MODE_NATURAL
    )
    {
        var_dump('Plugin1 - beforeGetMatchQuery');die;
    }
}

Any ideas?

2
  • If the class you are intercepting is instantiated via Object manager then you should be able to interception.
    – Marius
    Feb 9 '17 at 11:51
  • I am pretty new to Magento 2 development. Only my 3rd week working with it .. do you mind explaining a bit more? Feb 9 '17 at 12:05
5

in etc/area/di.xml update this things, it will work.

 <type name="\Magento\Framework\DB\Helper\Mysql\Fulltext">
    <plugin name="QuickSearch-plugin" type="Vendor\ExtendedQuickSearch\Plugin\QuickSearch" />
</type>
1
  • @AnandOntigeri worked like a charm thanks! Although you are missing a double quote after name=
    – Dan Norris
    May 2 '17 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.