LDAP command which cancels the previous search

62 Views Asked by At

I am using LDAP search whenever user does a key press. Which will cause lot of search in LDAP. For example if i am searching for user Ann, it will search for A then An and then Ann. Is there some command which will cancel previous search. If I press Ann, LDAP should stop searching for An and start new search for Ann immediately?

This is my code:

deSearch.Filter = String.Format(@"(|{0})", mysearchquery);

SearchResultCollection myresults = deSearch.FindAll();
1

There are 1 best solutions below

0
On

Yes, you should cancel the previous LDAP operation using the Abandon operation (which has no results, so you cannot be sure it's been abandoned), or the Cancel Extended operation for those servers that are supporting it (OpenDJ, OpenLDAP...).

The idea of introducing a short delay before sending the request is also a best practice.