How to combine search Filters in python LDAP?
python, python-2.7, python-ldap
Solution
I think `search_filter` has to be a string. Have you tried this?
search_filter = "(&(city=Bangalore)(manageruid=278586))"
Problem
While accessing LDAP data , I am continuously receiving the `Size Limit Exceeded` error. One of the solutions presented on google asked for much tighter search Filters. How is it possible to combine two or more search filters in python LDAP ? Using the suggested `(|(filter1)(filter2))` is producing an error. Here is the query : ``` baseDn = "ou=active, ou=employees, ou=people, o=xxxxx.com"; searchScope = ldap.SCOPE_SUBTREE #retrieve Certain attributes retrieveAttributes = ["manageruid","manager","cn"] search_query = raw_input("Enter the query :") #This searchFilter needs to be more specific searchFilter = "city=" + "Bangalore" try : ldap_result_id = l.search(baseDn, searchScope, searchFilter, retrieveAttributes) result_set = [] while 1: result_type, result_data = l.result(ldap_result_id, 0) if(result_data == []): break else: if result_type == ldap.RES_SEARCH_ENTRY: result_set.append(result_data) #print result_set print len(result_set) except ldap.LDAPError, e: print e ``` While trying to combine search filters : This error comes. ``` File "practice.py", line 33 search_filter = (&("city=Bangalore")("manageruid=278586")) ^ SyntaxError: invalid syntax ```