Skip to content

Commit 57a185e

Browse files
author
Hwashiang Yu
committed
Merge remote-tracking branch 'upstream/2.3-qwerty' into MC-15662
2 parents f3d31fd + 1f34e8c commit 57a185e

File tree

2 files changed

+2
-33
lines changed

2 files changed

+2
-33
lines changed

app/code/Magento/Search/Model/ResourceModel/SynonymReader.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,10 @@ protected function _construct()
8585
*/
8686
private function queryByPhrase($phrase)
8787
{
88-
$phrase = $this->fullTextSelect->removeSpecialCharacters($phrase);
8988
$matchQuery = $this->fullTextSelect->getMatchQuery(
9089
['synonyms' => 'synonyms'],
91-
$this->escapePhrase($phrase),
92-
Fulltext::FULLTEXT_MODE_BOOLEAN
90+
$phrase,
91+
Fulltext::FULLTEXT_MODE_NATURAL
9392
);
9493
$query = $this->getConnection()->select()->from(
9594
$this->getMainTable()
@@ -98,18 +97,6 @@ private function queryByPhrase($phrase)
9897
return $this->getConnection()->fetchAll($query);
9998
}
10099

101-
/**
102-
* Cut trailing plus or minus sign, and @ symbol, using of which causes InnoDB to report a syntax error.
103-
*
104-
* @see https://dev.mysql.com/doc/refman/5.7/en/fulltext-boolean.html
105-
* @param string $phrase
106-
* @return string
107-
*/
108-
private function escapePhrase(string $phrase): string
109-
{
110-
return preg_replace('/@+|[@+-]+$/', '', $phrase);
111-
}
112-
113100
/**
114101
* A private helper function to retrieve matching synonym groups per scope
115102
*

lib/internal/Magento/Framework/DB/Helper/Mysql/Fulltext.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@
1414
*/
1515
class Fulltext
1616
{
17-
/**
18-
* Characters that have special meaning in fulltext match syntax
19-
*
20-
* @var string
21-
*/
22-
const SPECIAL_CHARACTERS = '-+<>*()~';
23-
2417
/**
2518
* FULLTEXT search in MySQL search mode "natural language"
2619
*/
@@ -106,15 +99,4 @@ public function match($select, $columns, $expression, $isCondition = true, $mode
10699

107100
return $select;
108101
}
109-
110-
/**
111-
* Remove special characters from fulltext query expression
112-
*
113-
* @param string $expression
114-
* @return string
115-
*/
116-
public function removeSpecialCharacters(string $expression): string
117-
{
118-
return str_replace(str_split(static::SPECIAL_CHARACTERS), '', $expression);
119-
}
120102
}

0 commit comments

Comments
 (0)