As I recently got assigned to a SharePoint project, I had a scenario where I had to perform a search on a URL field. Checking loads on forums / blogs showed one or two solutions which did not resolve my problem. So I am posting my solution here just in case it helps any one else.
This is how I formed the CAML query :
SPQuery query = new SPQuery(); query.Query = "<Where><Contains><FieldRef Name='URL'/><Value Type='URL'>"+ urlParameter +"</Value></Contains></Where>"; //get the results SPListItemCollection result = list.GetItems(query);
where urlParameter variable holds the relative url i.e. /mysite/subsite
Some blogs suggested using <Eq> but that did not work for me, rather its <Contains> that did the trick.