Right sample of searching JUD

Can anyone provide me with a code sample for searching JUD while my key is the nick name, and the result is the user JID?

I tried, but I do not know the proper way to create a quesry that result with the user JUD

Thanks