You hire an attorney to fight the case. She will probably file a motion to suppress on the illegal search. It's hard to suppress a search when consent is given but there is caselaw that gives guidance as to when consent has been coerced. The right judge may very well grant this motion and throw the whole case out.
Macy Jaggers's answer to a legal question on Avvo does not establish an attorney-client relationship. Ms. Jaggers offers everyone a free consultation to discuss their case. Feel free to call her office at 214-365-9800 to make an appointment (phones are answered 24 hours) or visit her website at www.macyjaggers.com for more information about her services and recent victories.
This appears to be a duplicate question - this is my answer from the other question:
An attorney can help you contest the search and suppress anything found as a result of the search. In every criminal case, you are innocent until proven guilty and an attorney will help you protect your rights. A charge of possession of a controlled substance is serious and the sooner you contact an attorney, the better.
The information provided does not constitute legal advice and is presented without any representation or warranty whatsoever, including as to the accuracy or completeness of the information. Always contact an attorney when seeking legal advice.
You should consult with an attorney as soon as possible. There may be an issue with whether you actually consented to the search that could assist you in your legal defense. It is not possible to give you a clearer picture of your options without more specific information.
Possession of a controlled substance is a serious offense. You need the assistance of an attorney for this matter.
Nothing in this answer constitutes an agreement to represent you in any criminal case. Additionally, the information provided above does not constitute legal advice.