Update MysqlSearchEngine::getFulltextMinimumWordLength() for InnoDB
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 5 Feb 2021 14:55:06 +0000 (15:55 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 5 Feb 2021 14:55:06 +0000 (15:55 +0100)
At the same time copy over the deprecation comment from AbstractSearchEngine.

see 7d059540531e82c12b0aec2ad50e38a6788657cc
Resolves #3948

wcfsetup/install/files/lib/system/search/mysql/MysqlSearchEngine.class.php

index 2d66c00ec01df209642f687139763350ba692cd9..0c292b5b185942926018515e0698bcaecf9cfbca 100644 (file)
@@ -22,8 +22,7 @@ use wcf\util\StringUtil;
 class MysqlSearchEngine extends AbstractSearchEngine
 {
     /**
-     * MySQL's minimum word length for fulltext indices
-     * @var int
+     * @deprecated 5.4 - This property is used for the deprecated getFulltextMinimumWordLength().
      */
     protected $ftMinWordLen;
 
@@ -457,12 +456,12 @@ class MysqlSearchEngine extends AbstractSearchEngine
     }
 
     /**
-     * @inheritDoc
+     * @deprecated 5.4 - This method was required for use in parseSearchQuery().
      */
     protected function getFulltextMinimumWordLength()
     {
         if ($this->ftMinWordLen === null) {
-            $sql = "SHOW VARIABLES LIKE 'ft_min_word_len'";
+            $sql = "SHOW VARIABLES LIKE 'innodb_ft_min_token_size'";
 
             try {
                 $statement = WCF::getDB()->prepareStatement($sql);
@@ -470,7 +469,7 @@ class MysqlSearchEngine extends AbstractSearchEngine
                 $row = $statement->fetchArray();
             } catch (DatabaseException $e) {
                 // fallback if user is disallowed to issue 'SHOW VARIABLES'
-                $row = ['Value' => 4];
+                $row = ['Value' => 3];
             }
 
             $this->ftMinWordLen = $row['Value'];