Answer:
If they arrest you, if you give them consent, for safety reasons, at public facilities.
Step-by-step explanation:
A police officer can search a person if he/she is being arrested. Also, when the person agree to allow them the search and it is limited to what the person consented to.
Besides, if the police suspect that a person is involve in a crime, they can do it for safety reasons but with restrictions.
Also, if a person is going into a public facility like a court, the police can search that person.