[DATABASE] Enable fulltext search by default

Also rename fulltext indices to more fitting names
and move the check from classes into database/schema.php
This commit is contained in:
Alexei Sorokin 2020-08-08 18:08:06 +03:00
parent 34ec165bff
commit f84dbb369f
6 changed files with 16 additions and 23 deletions

View File

@ -744,11 +744,9 @@ search
Some stuff for search.
* `type`: type of search. Ignored if PostgreSQL or Sphinx are enabled. Can either
be 'fulltext' or 'like' (default). The former is faster and more efficient
but requires the lame old MyISAM engine for MySQL. The latter
will work with InnoDB but could be miserably slow on large
systems. We'll probably add another type sometime in the future,
with our own indexing system (maybe like MediaWiki's).
be 'like' or 'fulltext' (default). The latter is faster and more efficient
but if your storage engine of choice does not support it, then feel free to
choose 'like', but it could be miserably slow on large databases.
sessions

View File

@ -115,13 +115,12 @@ class Notice extends Managed_DataObject
'notice_verb_idx' => array('verb'),
'notice_url_idx' => array('url'), // Qvitter wants this
'notice_reply_to_idx' => array('reply_to')
)
),
'fulltext indexes' => array(
'notice_fulltext_idx' => array('content'),
),
);
if (common_config('search', 'type') == 'fulltext') {
$def['fulltext indexes'] = array('content' => array('content'));
}
return $def;
}

View File

@ -62,15 +62,12 @@ class Profile extends Managed_DataObject
'primary key' => array('id'),
'indexes' => array(
'profile_nickname_idx' => array('nickname'),
)
),
'fulltext indexes' => array(
'profile_fulltext_idx' => array('nickname', 'fullname', 'location', 'bio', 'homepage'),
),
);
// Add a fulltext index
if (common_config('search', 'type') == 'fulltext') {
$def['fulltext indexes'] = array('nickname' => array('nickname', 'fullname', 'location', 'bio', 'homepage'));
}
return $def;
}

View File

@ -370,11 +370,6 @@ class MysqlSchema extends Schema
public function preferredEngine($def)
{
/* MyISAM is no longer required for fulltext indexes, fortunately
if (!empty($def['fulltext indexes'])) {
return 'MyISAM';
}
*/
return 'InnoDB';
}

View File

@ -1061,6 +1061,10 @@ class Schema
}
}
if (common_config('search', 'type') !== 'fulltext') {
unset($tableDef['fulltext indexes']);
}
return $tableDef;
}

View File

@ -301,7 +301,7 @@ $default =
'allow_tagging' => array('all' => true), // equivalent to array('local' => true, 'remote' => true)
'desclimit' => null),
'search' =>
array('type' => 'like'),
array('type' => 'fulltext'),
'sessions' =>
array('handle' => false, // whether to handle sessions ourselves
'debug' => false, // debugging output for sessions