зеркало из https://github.com/mozilla/gecko-dev.git
Improve search for edit_users.cgi.
This commit is contained in:
Родитель
734802cbe0
Коммит
4f55f337d0
|
@ -21,6 +21,8 @@ Time::Piece::mysql
|
||||||
Time::Seconds
|
Time::Seconds
|
||||||
HTML::StripScripts
|
HTML::StripScripts
|
||||||
HTML::StripScripts::Parser
|
HTML::StripScripts::Parser
|
||||||
|
Text::Markdown
|
||||||
|
XML::XPath
|
||||||
|
|
||||||
Once you've got everything installed, run: mysql < createdb.sql to
|
Once you've got everything installed, run: mysql < createdb.sql to
|
||||||
create the Litmus database.
|
create the Litmus database.
|
||||||
|
|
|
@ -66,16 +66,20 @@ __PACKAGE__->set_sql(TopTesters => qq{
|
||||||
LIMIT 15
|
LIMIT 15
|
||||||
});
|
});
|
||||||
|
|
||||||
# search by email, realname, or irc_nickname
|
# the COLLATE latin1_general_ci sillyness forces a case-insensitive match
|
||||||
__PACKAGE__->set_sql(FullTextMatches => qq{
|
__PACKAGE__->set_sql(FullTextMatches => q{
|
||||||
SELECT *,
|
SELECT *
|
||||||
MATCH (email, realname, irc_nickname) AGAINST (?) AS relevance
|
|
||||||
FROM __TABLE__
|
FROM __TABLE__
|
||||||
WHERE MATCH (email, realname, irc_nickname) AGAINST (?) HAVING relevance > 0
|
WHERE
|
||||||
ORDER BY relevance DESC, user_id ASC
|
email COLLATE latin1_general_ci like concat('%%',?,'%%') OR
|
||||||
LIMIT 100
|
irc_nickname COLLATE latin1_general_ci like concat('%%',?,'%%') OR
|
||||||
|
realname COLLATE latin1_general_ci like concat('%%',?,'%%')
|
||||||
|
ORDER BY email ASC
|
||||||
|
LIMIT 300
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# returns the crypt'd password from a linked Bugzilla account if it
|
# returns the crypt'd password from a linked Bugzilla account if it
|
||||||
# exists or the Litmus user account
|
# exists or the Litmus user account
|
||||||
|
|
|
@ -227,6 +227,7 @@ sub DropIndex {
|
||||||
my $ref = $self->GetIndexDef($table, $index);
|
my $ref = $self->GetIndexDef($table, $index);
|
||||||
return unless $ref; # no matching index?
|
return unless $ref; # no matching index?
|
||||||
|
|
||||||
|
print "Removing index $index from table $table ...\n";
|
||||||
$self->{'dbh'}->do("ALTER TABLE $table
|
$self->{'dbh'}->do("ALTER TABLE $table
|
||||||
DROP INDEX $index");
|
DROP INDEX $index");
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ Litmus::Auth::requireAdmin('edit_users.cgi');
|
||||||
if ($c->param('search_string')) {
|
if ($c->param('search_string')) {
|
||||||
# search for users:
|
# search for users:
|
||||||
my $users = Litmus::DB::User->search_FullTextMatches(
|
my $users = Litmus::DB::User->search_FullTextMatches(
|
||||||
|
$c->param('search_string'),
|
||||||
$c->param('search_string'),
|
$c->param('search_string'),
|
||||||
$c->param('search_string'));
|
$c->param('search_string'));
|
||||||
my $vars = {
|
my $vars = {
|
||||||
|
|
|
@ -237,6 +237,10 @@ $dbtool->AddFullText("users", "key", "(email, realname, irc_nickname)");
|
||||||
$dbtool->DropIndex("users", "irc_nickname");
|
$dbtool->DropIndex("users", "irc_nickname");
|
||||||
$dbtool->AddKey("users", "irc_nickname", "(irc_nickname)");
|
$dbtool->AddKey("users", "irc_nickname", "(irc_nickname)");
|
||||||
|
|
||||||
|
# this should be a normal index, not a fulltext index
|
||||||
|
$dbtool->DropIndex("users", "key(email, realname, irc_nickname)");
|
||||||
|
$dbtool->AddKey("users", '(email, realname, irc_nickname)', '');
|
||||||
|
|
||||||
|
|
||||||
print "Schema update complete.\n\n";
|
print "Schema update complete.\n\n";
|
||||||
print <<EOS;
|
print <<EOS;
|
||||||
|
|
|
@ -350,4 +350,4 @@ $table{users} =
|
||||||
index(realname),
|
index(realname),
|
||||||
index(enabled),
|
index(enabled),
|
||||||
index(is_admin),
|
index(is_admin),
|
||||||
fulltext key(email, realname, irc_nickname)';
|
index(email, realname, irc_nickname)';
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#
|
#
|
||||||
#%]
|
#%]
|
||||||
|
|
||||||
|
<p>You may search by email address, real name, or irc nickname.</p>
|
||||||
|
|
||||||
<form action="edit_users.cgi" method="get" name="form" id="form">
|
<form action="edit_users.cgi" method="get" name="form" id="form">
|
||||||
List users matching
|
List users matching
|
||||||
<input name="search_string" size="35" />
|
<input name="search_string" size="35" />
|
||||||
|
|
Загрузка…
Ссылка в новой задаче