mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX Filter out all FULLTEXT BOOLEAN chars
The query might still work depending on where these chars are placed, but it seems weird to only remove *some* of the valid chars here. See https://dev.mysql.com/doc/refman/5.6/en/fulltext-boolean.html Note that the query runs both the actual boolean query with chars, and then a separate relevance search without them.
This commit is contained in:
parent
0215fdd262
commit
2c5deceeb4
@ -227,8 +227,9 @@ class MySQLDatabase extends Database implements TransactionManager
|
||||
$match[$fileClass] = "MATCH (Name, Title) AGAINST ('$keywords' $boolean) AND ClassName = '$fileClassSQL'";
|
||||
|
||||
// We make the relevance search by converting a boolean mode search into a normal one
|
||||
$relevanceKeywords = str_replace(array('*', '+', '-'), '', $keywords);
|
||||
$htmlEntityRelevanceKeywords = str_replace(array('*', '+', '-'), '', $htmlEntityKeywords);
|
||||
$booleanChars = ['*', '+', '@', '-', '(', ')', '<', '>'];
|
||||
$relevanceKeywords = str_replace($booleanChars, '', $keywords);
|
||||
$htmlEntityRelevanceKeywords = str_replace($booleanChars, '', $htmlEntityKeywords);
|
||||
$relevance[$pageClass] = "MATCH (Title, MenuTitle, Content, MetaDescription) "
|
||||
. "AGAINST ('$relevanceKeywords') "
|
||||
. "+ MATCH (Title, MenuTitle, Content, MetaDescription) AGAINST ('$htmlEntityRelevanceKeywords')";
|
||||
|
@ -34,5 +34,4 @@ class TestObject extends DataObject implements TestOnly
|
||||
'columns' => ['ColumnE'],
|
||||
],
|
||||
);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user