/** * {@inheritdoc} */ public function build(ScoreBuilder $scoreBuilder, Select $select, RequestQueryInterface $query, $conditionType) { /** @var $query \Magento\Framework\Search\Request\Query\Match */ foreach ($query->getMatches() as $match) { $mode = Select::FULLTEXT_MODE_NATURAL; if ($conditionType === Bool::QUERY_CONDITION_NOT) { $match['value'] = '-' . $match['value']; $mode = Select::FULLTEXT_MODE_BOOLEAN; } $scoreBuilder->addCondition($select->getMatchQuery($match['field'], $match['value'], $mode), isset($match['boost']) ? $match['boost'] : 1); $select->match($match['field'], $match['value'], true, $mode); } return $select; }