Skip to main content

Bug Tracker

Side navigation

#5222 closed bug (invalid)

Opened September 14, 2009 10:16PM UTC

Closed October 12, 2009 11:47PM UTC

[autocomplete] Autocomplete plugin "max" parameter causes search hits to be missed

Reported by: alexch Owned by:
Priority: major Milestone: 1.4
Component: plugin Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

This is apparently a design flaw in Dylan Verheul's autocomplete plugin, caused by the interaction between the "max" parameter and the local cache for remote searches.

Consider a search for "foo" in a query that returns 11 items containing "f". The first item is "food" and the 11th item is "foolish". The default value of "max" is 10 so when the user types "f" it will return the first 10 items, including "food" but not including "foolish". Then the user continues typing, and when he hits "foo"...

What he should see is 2 items, "food" and "foolish".

What he does see is only 1 item, "food." The "foolish" was never fetched from the database because "foo" found a hit in the local cache ("food") so it just returned it and figured its job was done.

This is around line 328 of the version " * Revision: $Id: jquery.autocomplete.js 5747 2008-06-25 18:30:55Z joern.zaefferer $":

// recieve the cached data

if (data && data.length) {

success(term, data);

At the moment I can't think of a way to preserve both the "max" feature and the local cache without also preserving this bug. The "max" feature may need to be removed or respecified since IMHO this is a pretty bad edge case. It just hit my app in production, too. :-(

Attachments (0)
Change History (1)

Changed October 12, 2009 11:47PM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

This is not a jQuery core bug. Please report plugin bugs to the plugin's author, or ask on the jQuery forums. jQuery UI bugs should be reported on the UI bug tracker, http://dev.jqueryui.com .