in order to stop you an officer must have "reasonable suspicion" that a crime has occurred. (aka traffic violation has occurred for a traffic stop). The officer does not have to actually issue you a citation, but only specific and articulable facts to suspect that a crime has been committed.
Once the officer conducts the stop, he will then need probable cause to conduct the search, UNLESS YOU CONSENT TO THE SEARCH. If you consent, then the officer does not need probable cause.
Getting pulled over when you committed no traffic violations would be illegal. It calls into question when no warning or citation is issued and the officer searches the car. Was consent given for the search?