Originally Posted by el twe
Yeah, that was illegal. Unless she felt that you posed a threat to her (acting nervous doesn't count - everyone gets nervous), she has no right to search you without consent. The first thing you want to ask in a situation like this is, "Am I free to go?" If you get a reply other than "No," leave.
Another good phrase to use is "Are you holding me against my will?".