Auto-suggest Technologies and Options [closed]
I would like to integrate auto-suggest on my website. Which option should I pursue? Are there any advantages with going the jQuery route vs the Javascript route? What about disadvantages?
What about having my local javascript request information from server-side JSP? I have about 10,000 keywords in my database that I'll be using.
I would appreciate some direction on this. Thank you.
It's not jQuery vs Javascript. jQuery is merely cleverly-written javascript purposed to make your life easier, and it does just that. In fact, rather than having to create an auto-suggest element from scratch, you can download autosuggest plugins built with/for jQuery.
As for dealing with 10,000 items, I think I would fire off asynchronous requests while the user is typing to get specific items. If the user types in "app," you could find all keywords that begin with "app" and return them as the populants of the autosuggest box. This would greatly reduce bandwith and loading times.
You could do it in any programming language. You can study the OpenSearch specs and formats though, in order to provide something universal and reusable from third parties.
In my opinion JQuery is a good option to go with. I Personally used http://docs.jquery.com/Plugins/Autocomplete and this plugin is pretty much promising.
As far as 10,000 items are concerned you can use Indexing on particular column in DB to speedup searching process.
i would the following steps
create a dictionary in the client using json or something
1. wait for inputs > 4 characters in the text box
2. send the request to server using ajax
3. use like search in your sql query.
4. send back the data to the client
5. pass the data to the text box div overlay so that it highlights.
6. add the same data set to the dictionary. this will help for later searches.
精彩评论