Page MenuHomePhabricator

Autocomplete should not kick in till at least 2 characters
Closed, DeclinedPublic

Description

Author: paul.irish

Description:
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.

Fix

Line 481 of mwsuggest.js:
os_fetchResults(r,query,os_search_timeout);
becomes:
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


Version: 1.13.x
Severity: enhancement

Details

Reference
bz14139

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 10:10 PM
bzimport added a project: MediaWiki-Search.
bzimport set Reference to bz14139.

ayg wrote:

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.

candrews wrote:

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.

ayg wrote:

I think you meant || there, not &&.