Here is a page with what looks to me like good information on dealing with the police, including attempts to search. General advice seems to be
never co-operate, always challenge them and ask them under which power they want to conduct a search. But there are some situations where you have to comply. It's not clear if this information is applicable UK wide, I suspect it is a summary of the situation in England and Wales, as the police powers are slightly different in Scotland (see wiki pages linked below).
Pretty comprehensive wikipedia pages on police powers in
Scotland,
England and Wales.
IANAL. This is not legal advice.