More information is needed to give you an accurate answer, but as said above, the less you say the better off you are.
Most searches take place without a warrant. They are not always required. With the little bit that you give I can imagine how it might unfold without a warrant and be legitimate. The main question I have is why the police grabbed you in the doorway. Were you wanted for something? Their reason for contacting you is probably the key to everything that follows.
It is also possible that they knew what you were up to with the aid of an undercover or an informant. They may have already had probable cause to arrest you the moment you opened the door.