/** * Apply fulltext filters * * @param Collection $collection * @param Filter $filter * @return void */ public function apply(Collection $collection, Filter $filter) { if (!$collection instanceof AbstractDb) { throw new \InvalidArgumentException('Database collection required.'); } $mainTable = $collection->getResource()->getMainTable(); /** @var AbstractDb $collection */ $columns = $this->getFulltextIndexColumns($collection, $mainTable); if (!$columns) { return; } $columns = $this->addTableAliasToColumns($columns, $collection, $mainTable); $collection->getSelect() ->where( 'MATCH(' . implode(',', $columns) . ') AGAINST(?)', $filter->getValue() ); }