Yes it is legal. A male officer can perform a cursory search (in the nature of a patdown) of a female suspect if there is no female officer present. This means that he can check the major areas for guns and put his hands in her pockets. If necessary when no female officer is going to be present in a reasonable amount of time, he can search her on scene like he would a search a male.