1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

Provide setup instructions for reducing minimum index word length

Summary:
The MySQL MyISAM fulltext backend defaults to a minimum length of 4, but many
3-letter words are useful search terms. Provide instructions for configuring
MySQL to reduce the auto-stopword length.

Test Plan:
Followed instructions, searched for a 3-letter term and got a hit.

Reviewed By: jungejason
Reviewers: aran, tuomaspelkonen, jungejason
CC: aran, jungejason
Differential Revision: 471
This commit is contained in:
epriestley 2011-06-15 08:39:02 -07:00
parent c82c6e204f
commit 12772ec35f

View file

@ -313,6 +313,27 @@ class PhabricatorSetup {
self::write(" okay Database schema are up to date (v{$expect}).\n"); self::write(" okay Database schema are up to date (v{$expect}).\n");
} }
$index_min_length = queryfx_one(
$conn_raw,
'SHOW VARIABLES LIKE %s',
'ft_min_word_len');
$index_min_length = idx($index_min_length, 'Value', 4);
if ($index_min_length >= 4) {
self::writeNote(
"MySQL is configured with a 'ft_min_word_len' of 4 or greater, which ".
"means you will not be able to search for 3-letter terms. Consider ".
"setting this in your configuration:\n".
"\n".
" [mysqld]\n".
" ft_min_word_len=3\n".
"\n".
"Then optionally run:\n".
"\n".
" REPAIR TABLE phabricator_search.search_documentfield QUICK;\n".
"\n".
"...to reindex existing documents.");
}
self::write("[OKAY] Database configuration OKAY\n"); self::write("[OKAY] Database configuration OKAY\n");
@ -457,8 +478,9 @@ class PhabricatorSetup {
} }
private static function writeNote($note) { private static function writeNote($note) {
self::write( $note = "*** NOTE: ".wordwrap($note, 75, "\n", true);
'Note: '.wordwrap($note, 75, "\n ", true)."\n\n"); $note = "\n".str_replace("\n", "\n ", $note)."\n\n";
self::write($note);
} }
public static function writeHeader($header) { public static function writeHeader($header) {