@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

If InnoDB FULLTEXT is available, use it for for fulltext indexes

Summary: Ref T11741. I'll wait until the release cut to land this; it just adds a test for InnoDB FULLTEXT being available instead of always returning `false`.

Test Plan:
- Ran with InnoDB fulltext locally for a day and a half without issues.
- Ran `bin/storage upgrade`, saw it detect InnoDB fulltext.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11741

Differential Revision: https://secure.phabricator.com/D16946

+22 -5
+22 -5
src/applications/search/storage/document/PhabricatorSearchDocument.php
··· 40 40 } 41 41 42 42 public static function newQueryCompiler() { 43 - $table = new self(); 44 - $conn = $table->establishConnection('r'); 45 - 46 43 $compiler = new PhutilSearchQueryCompiler(); 47 44 48 45 if (self::isInnoDBFulltextEngineAvailable()) { 49 46 // The InnoDB fulltext boolean operators are always the same as the 50 47 // default MyISAM operators, so we do not need to adjust the compiler. 51 48 } else { 49 + $table = new self(); 50 + $conn = $table->establishConnection('r'); 51 + 52 52 $operators = queryfx_one( 53 53 $conn, 54 54 'SELECT @@ft_boolean_syntax AS syntax'); ··· 61 61 } 62 62 63 63 public static function isInnoDBFulltextEngineAvailable() { 64 - // For now, never consider this engine to be available. 65 - return false; 64 + static $available; 65 + 66 + if ($available === null) { 67 + $table = new self(); 68 + $conn = $table->establishConnection('r'); 69 + 70 + // If this system variable exists, we can use InnoDB fulltext. If it 71 + // does not, this query will throw and we're stuck with MyISAM. 72 + try { 73 + queryfx_one( 74 + $conn, 75 + 'SELECT @@innodb_ft_max_token_size'); 76 + $available = true; 77 + } catch (AphrontQueryException $x) { 78 + $available = false; 79 + } 80 + } 81 + 82 + return $available; 66 83 } 67 84 68 85 }