You can get charged for a single flake of marijuana, but chances are you won't. Besides, they're legally obligated to tell you what you're being charged with when you're being arrested. Lastly, your friend having dope is not probable cause to search you. Did you give him consent to search? Even if they say things like "Make this easy on yourself and let me search", it's total bull. Never co-operate unless you have no other choice. "If you have nothing to hide, you don't mind if I look, right" Implies that you will be considered guilty if you don't let them search. Also bull.

Either way, from your story, it DEFINATELY sounds like you got off. Hell if you had a lawyer you could probably sue for false imprisonment.

If you do go to court, you'll end up paying like a 40$ fine or do 10 hours community service. You won't do any time, that's for damned sure, especially if this is your first drug related offense, which given your confusion, I assume it it.

For the record, I've been arrested for drugs twice and have done insane amounts of research of the legal system/