开发者

Autocomplete on a LDAP Search form

开发者 https://www.devze.com 2023-01-05 13:39 出处:网络
I\'d like to know whether it\'s possible to implement autocompletion on a search form which is querying a LDAP directory.

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开发者_Go百科 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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号