Hello,
There are many grounds for reasonable suspicion for a search. Maybe have a look at what happened in the lead up and see if you can identify what may have been their grounds. IE do you have significant criminal history and/or does your boyfriend?
But even if they did have a criminal history, how could the police know until they checked against their names? Or are you implying the police were following them and knew who they were already? Unlikely given it sounds like police were doing pretty random checks at the time...