LDAP 搜索表单上的自动完成

发布于 2024-09-08 10:42:28 字数 368 浏览 2 评论 0原文

我想知道是否可以在查询 LDAP 目录的搜索表单上实现自动完成

我正在创建一个小部件,允许用户查找LDAP 目录中的人员,然后显示电话号码等信息。

目录中有很多人员,因此如果能够根据用户目前所写的内容自动完成表单来帮助用户,那就太好了。

实际上,这与jQuery UI 使用自动完成功能所做的差不多

我是否每次都必须直接请求 LDAP 目录用户按下某个键? 或者也许我应该缓存(本地或服务器上)?

感谢您的帮助

I'd like to know whether it's possible to implement autocompletion on a search form which is querying a LDAP directory.

I'm creating a small widget that allows users to look for people in the LDAP directory and then display information such as phone number etc.

There's a lot of people in the directory, so it would be nice to help users by auto-completing the form according to what they wrote so far.

It's actually pretty much what jQuery UI does with Autocomplete

Do I have to request directly the LDAP directory every time the user hits a key?
Or maybe should I cache (locally or on the server)?

Thanks for your help

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

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

发布评论

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

评论(2

墨离汐 2024-09-15 10:42:28

当然可以,但由于请求的往返,即使使用最快的 LDAP 服务器,您也会想要在搜索字段上使用“延迟观察者”事件侦听器。这意味着搜索请求不会在每次按键时立即发出,而是仅在用户键入一些字符并暂停一段时间后发出。

我相信 jquery UI 已经为其自动完成功能实现了延迟观察器,scriptaculous 的自动完成小部件也是如此。

PS 在 javascript 和本地查找中本地缓存目录中的所有用户对于超过数百个用户来说实际上不起作用,恕我直言。

Sure you can, but due to the round-trip of the request, even with the quickest of LDAP servers, you'll want to use a "delayed observer" event listener on the search field. This means that the request for the search won't go immediately on every keypress, but only after the user types some characters and pauses for a while.

I believe jquery UI already implements a delayed observer for its autocomplete things, as does scriptaculous' autocomplete widget.

P.S. Caching of all users in the directory locally in javascript and local lookup won't really work for more than a couple of hundreds of users, IMHO.

装迷糊 2024-09-15 10:42:28

您绝对可以使用通配符过滤器(如 (givenName=E*))执行 LDAP 搜索。 LDAP 针对目录搜索进行了优化,通常如果您只使用副本,则可以很好地扩展。

如果您遇到容量问题,我建议您执行单个列表操作并缓存结果。我更喜欢的缓存策略是在服务器端,因为这会减少服务器上的负载。

You could definitely perform an LDAP search using a wild card filter like (givenName=E*). LDAP is optimized for directory searches, and usually if you're only using the replicas, this can scale pretty well.

If you're running into capacity issues, I would recommend you perform a single list operation and cache the results. My preferable caching strategy would be on the server side, since that would reduce the load on your server.

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