Although I do not practice law in the State of New York, here are my initial impressions. The general rule is that the fourth amendment prohibits searches without a warrant; however, the warrant requirement is subject to several exceptions, especially in the context of "stop and frisks", otherwise known as a "Terry" stop, named after the Supreme Court case of Terry v. Ohio. To determine whether the search was illegal in this situation, it would be necessary to review the specific facts as contained in the police report. In any event, however, you should discuss whether there is a valid suppression issue with your attorney and/or public defender in the interest of obtaining a favorable resolution to this matter. Good luck.