Page MenuHomePhorge

No OneTemporary

Size
960 B
Referenced Files
None
Subscribers
None
diff --git a/includes/search/SearchMySQL.php b/includes/search/SearchMySQL.php
index 55445051106..d5d39ce0cc4 100644
--- a/includes/search/SearchMySQL.php
+++ b/includes/search/SearchMySQL.php
@@ -162,6 +162,17 @@ class SearchMySQL extends SearchDatabase {
public function legalSearchChars( $type = self::CHARS_ALL ) {
$searchChars = parent::legalSearchChars( $type );
+
+ // In the MediaWiki UI, search strings containing (just) a hyphen are translated into
+ // MATCH(si_title) AGAINST('+- ' IN BOOLEAN MODE)
+ // which is not valid.
+
+ // From <https://dev.mysql.com/doc/refman/8.0/en/fulltext-boolean.html>:
+ // "InnoDB full-text search does not support... a plus and minus sign combination ('+-')"
+
+ // See also https://phabricator.wikimedia.org/T221560
+ $searchChars = preg_replace( '/\\\\-/', '', $searchChars );
+
if ( $type === self::CHARS_ALL ) {
// " for phrase, * for wildcard
$searchChars = "\"*" . $searchChars;

File Metadata

Mime Type
text/x-diff
Expires
Sat, Jul 5, 5:32 AM (18 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
227693
Default Alt Text
(960 B)

Event Timeline