Skip to content

Commit

Permalink
Fulltext replacement with like condition when a SearchCriteria is app…
Browse files Browse the repository at this point in the history
…lied to a DB collection.

See magento/inventory#1221
  • Loading branch information
phoenix128 committed Jun 2, 2018
1 parent f8b1e47 commit 7259c4b
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ private function addFilterGroupToCollection(
if (!$isApplied) {
$condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq';
$fields[] = $this->getFieldMapping($filter->getField());

if ($condition === 'fulltext') {
// NOTE: This is not a fulltext search, but the best way to search something when
// a SearchCriteria with "fulltext" condition is provided over a MySQL table
// (see https://github.com/magento-engcom/msi/issues/1221)
$condition = 'like';
$filter->setValue('%' . $filter->getValue() . '%');
}

$conditions[] = [$condition => $filter->getValue()];
}
}
Expand Down

0 comments on commit 7259c4b

Please sign in to comment.