next time, say these words:

"I don't submit to any searches."

"Am I free to go now, or are you detaining me?"

"I'm going to remain silent."

It could have saved you a lot of trouble, because if the cop technically is asking you to submit to a search, you can say no. It won't sound like a question even when it is, but unless it's a direct order, say no.