[Freeipa-devel] [PATCH] search for multiple things

Rob Crittenden rcritten at redhat.com
Tue Dec 11 19:32:43 UTC 2007


Simo Sorce wrote:
> On Tue, 2007-12-11 at 09:14 -0500, Rob Crittenden wrote:
>> There was a discussion a few weeks ago about searching for "Bill Ben" 
>> not returning both Bill AND Ben records. Pete insisted that this was a 
>> regression though I could find nothing in the repo history that would 
>> have affected this. It could have been some uncommitted patch, I don't know.
>>
>> In any case, I think this will fix it.
>>
>> diff -r 7e77cf165b4a ipa-server/xmlrpc-server/funcs.py
>> --- a/ipa-server/xmlrpc-server/funcs.py Mon Dec 10 21:55:12 2007 -0500
>> +++ b/ipa-server/xmlrpc-server/funcs.py Tue Dec 11 09:13:12 2007 -0500
>> @@ -319,8 +319,8 @@ class IPAServer:
>>           gen_search_pattern = lambda word: search_pattern % {'match':word}
>>
>>           # construct the giant match for all words
>> -        exact_match_filter = "(&"
>> -        partial_match_filter = "(&"
>> +        exact_match_filter = "(|"
>> +        partial_match_filter = "(|"
>>           for word in criteria_words:
>>               exact_match_filter += gen_search_pattern(word)
>>               partial_match_filter += gen_search_pattern("*%s*" % word)
> 
> Rob I have not looked at the code that encapsulate this snippet yet, but
> from the names I have the sensation that he right fix would be instead:
> 
> exact_match_filter = "(&"
> partial_match_filter = "(|"
> 
> Simo.
> 

Ok, that seems to work too. I have a user "Ben" and a user "Bill" and 
when I enter "Bill Ben" I get both as expected.

Here are the filters:

exact: (&(|(uid=bill)(givenName=bill)(sn=bill)(telephoneNumber=bill)
(ou=bill)(title=bill))(|(uid=ben)(givenName=ben)(sn=ben)(telephoneNumber=ben)
(ou=ben)(title=ben)))

partial: (|(|(uid=*bill*)(givenName=*bill*)(sn=*bill*)
(telephoneNumber=*bill*)(ou=*bill*)(title=*bill*))
(|(uid=*ben*)(givenName=*ben*)(sn=*ben*)(telephoneNumber=*ben*)
(ou=*ben*)(title=*ben*)))

rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3245 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20071211/8987731f/attachment.bin>


More information about the Freeipa-devel mailing list