自动建议技术和选项

发布于 2024-08-23 06:15:51 字数 172 浏览 11 评论 0原文

我想在我的网站上集成自动建议。我应该选择哪种选择?与 Javascript 路线相比,采用 jQuery 路线有什么优势吗?缺点呢?

让我的本地 javascript 从服务器端 JSP 请求信息怎么样?我的数据库中有大约 10,000 个我将使用的关键字。

我希望得到一些有关这方面的指导。谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

春风十里 2024-08-30 06:15:51

这不是 jQuery 与 Javascript 的较量。 jQuery 只是巧妙编写的 JavaScript,旨在让您的生活更轻松,而它也确实做到了这一点。事实上,您不必从头开始创建自动建议元素,您可以下载 autosuggest 插件

至于处理 10,000 个项目,我认为我会在用户键入内容以获取特定项目时触发异步请求。如果用户输入“app”,您可以找到所有以“app”开头的关键字,并将它们作为自动建议框的填充项返回。这将大大减少带宽和加载时间。

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.

不疑不惑不回忆 2024-08-30 06:15:51

您可以使用任何编程语言来完成它。不过,您可以研究 OpenSearch 规范和格式,以便提供第三方通用且可重用的内容。

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.

梦断已成空 2024-08-30 06:15:51

在我看来,JQuery 是一个不错的选择。我个人使用 http://docs.jquery.com/Plugins/Autocomplete 这个插件是很有希望。

就 10,000 个项目而言,您可以在数据库中的特定列上使用索引来加速搜索过程。

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.

挽心 2024-08-30 06:15:51

我会执行以下步骤

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.

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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文