Find user with lowercase [message #17961] |
Tue, 27 April 2004 19:45 |
Gribnif
Messages: 82 Registered: December 2003
Karma: 0
|
Member |
|
|
It seems that the LIKE operator is case-sensitive, so if a user look for "gribnif" they won't find me, since my name is "Gribnif". To avoid this problem, I just made the following change to line 35 of pmuserloc.php.t:
$c = uq("SELECT alias FROM {SQL_TABLE_PREFIX}users WHERE ucase(alias) LIKE '".addslashes(str_replace('\\', '\\\\', strtoupper($usr_login)))."%' AND id>1");
I suggest making this change in the CVS. I think the same change should be made to finduser, as well, at line 47:
$qry = "ucase(alias) LIKE '".addslashes(htmlspecialchars(str_replace('\\', '\\\\', strtoupper($usr_login))))."%' AND";
|
|
|
Re: Find user with lowercase [message #17964 is a reply to message #17961] |
Tue, 27 April 2004 20:10 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
Can't be helped, doing lower() or ucase() on the keyword prevents the SQL engine from using indexes, making the query very slow.
FUDforum Core Developer
|
|
|
|
Re: Find user with lowercase [message #17966 is a reply to message #17965] |
Tue, 27 April 2004 20:18 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
For forum with with 50-100 users it may be ok, but most forums have couple of thousand users where this thing becomes unacceptably slow.
FUDforum Core Developer
|
|
|
|
Re: Find user with lowercase --> full wildcards [message #17978 is a reply to message #17975] |
Wed, 28 April 2004 13:29 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
The member list search supports forward wild card automatically. So if you don't know the name you can search by the 1st 1-2 letters, perhaps get a longer list matches but find the name non-the less. Most people would only upper case the 1st letter anyway.
Like I said before automatic case-insensitive search would be too slow.
FUDforum Core Developer
|
|
|
|
Re: Find user with lowercase [message #17985 is a reply to message #17983] |
Wed, 28 April 2004 13:44 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
A warning is something I'll consider, somehow in almost 2 years of FUDforum's existence this issue had never come up. So, I can't help but wonder just how common this problem is and whether or not a warning message is really needed.
Even with 400+ users this would be rather slow, since the SQL engine would need to go through every record, lowercase it and perform a case-insensitive comparison. It really does not take many users to cause a slowdown.
FUDforum Core Developer
|
|
|