Were they any dogs around the area when you got pulled aside and searched? Because if so, the dog has probably indicated that you have the smell of drugs on you, and as such, it's the officers duty for you to be searched. It's happened to me several times, usually when I went to camden, as my mates smoke weed, it got into my clothes, and as such, I got stopped. I didn't have anything on me, so it was just a 5 minute inconvenience.
If a dog's not there they say they're there looking for knives and are 'randomly' searching people. Funnily enough they randomly choose the young and the hippiest looking people they can find.
No wonder they have such a low success rate for finding knives. Perhaps they're happier with successful drug finds.

.