I am using jQuery.autocomplete(1.02) on my search box and I want exact string and substring matching. I don’t care (yet!) about the database load, I’m happy for it to fire off a query every keystroke and bypass the caching entirely – I just don’t want anything missed.
To this end I have tried setting cacheLength=1, the minimum permitted, but the autocomplete function refuses to fire off a GET request for each key up.
searchbox GET_request 'a' -> http://localhost/service_search_request?q=a 'ar' -> http://localhost/service_search_request?q=ar 'ars' -> http://localhost/service_search_request?q=ars
Instead, it sends the first and the third and misses the second, giving me the wrong results for ‘ar’ :-/ I’ve cleared my cache and sessions but it looks like some sort of caching is still going on. AFAIK I have no proxying going on and I’m shift-refreshing each time. It looks likely then that this behavior is from jQuery.autocomplete itself.
So my questions are…
A) Does this seem likely? i.e. is it a feature, or maybe a bug?
B) If so is there a clean way around it?…
C) If not, what autocomplete would you use instead?
Naturally D) No you’re just using it incorrectly you douche! is always a possibility, and indeed the one I’d prefer having spent time going down this road – assuming it comes with a link to the docs I’ve failed to find / read!
Cheers,
Roger 🙂
I wonder why cacheLength doesn’t work, but had trouble with autocomplete too. IMHO, there are errors in it. However, in the list of options, there is a matchSubset you could set to false.
EDIT: somewhere around line 335 is a function called ‘request’. You could add some debug messages to it, to see what happens: (note: you need firebug installed or ‘console’ will be unknown)
‘flushCache’ can easily be used in the function you can attach / set as options. I used this, to clear the Cache, if there could be more data in the backend: