Last modified: 2011-03-13 18:06:32 UTC
To preserve apparent responsiveness and deliver the most relevant results quickly, I suggest that the search suggest functionality shouldn't make an ajax call until there are at least two characters already typed in the box.
Line 481 of mwsuggest.js:
if (query.length>=2) os_fetchResults(r,query,os_search_timeout);
Btw- more best practices here: http://developer.yahoo.com/ypatterns/pattern.php?pattern=autocomplete
An unusual first character such as ! or, I don't know, γ (on, say, enwiki) can return meaningful results without a second one being provided.
Agreed; consider also CJK, where one Unicode character may carry significantly more information.
I agree with paul irish that searching shouldn't start until the 2nd character is entered into the search box, but I do see the point about CJK. Perhaps a solution like the following filter being run on the client side would work:
if (query.length >=2 && ! query.match(/[A-Za-z]/))
That would still execute the search after the first character for CJK languages, greek characters, !'s, and all those other non-Latin letters.
I think you meant || there, not &&.