One of the most common complaints I hear from clients is that they believe they were illegally searched by the police. It's important to note that search and seizure issues are among the most complex areas of law and very difficult to win.
Even if you have a valid claim, that does not mean that you automatically prevail. Ultimately the judge must agree with you - and they rarely do. And in virtually every case you're going to have a zealous prosecutor vehemently arguing that the search was legal.
However, Fourth Amendment violations are serious and worth pursuing in the right case. If you're lucky enough to have a judge grant a "motion to suppress" it could very well result in dismissal of your case.
In any event, before you assume that you've been illegally detained, arrested or searched, have an experienced attorney give you an objective, well-informed legal opinion.