Your public defender is correct, these matters are not cut and dry and there is always new issues and new rules, changes to existing rules ect. The officers generally are allowed to search as an incident to a lawful arrest, even sometimes an unlawful arrest may not always invalidate the search. The 4th amendments corner stone is reasonableness, the courts have generally over the past 15-20 years been more and more open to police searches. The officers can search if given consent and they are experts at getting people to consent to things they do not even know exist, a skilled officer can have a person waive nearly all their rights in under 10 minutes, and the person will be none the wiser. Many times the "request" to search is worded as a statement and they will claim that the person did not object, the state would argue that is consent to search. The main factor is probable cause, which is the officer has a good reason to believe there is contraband or criminal activity, something he can articulate, more than suspicion, there should be an observation, or report that is reliable. This is the standard most car searches are done by, the question is "what made the officer believe that there was contraband or a crime was being committed?" There is of course the plain view exception which means any contraband in plain view can be confiscated, and that usually gives cause to search the rest of the area. Theres different rules for closed containers inside the vehicle. There also the inevitable discovery rule, where the items would have eventually been found by lawful means anyway. Then theres the Leon rule from US vs Leon where the supreme court held that officers acting in good faith making an illegal search, does not mandate the evidence be excluded. for instance is you happen to have the same name and description as someone they are looking for and are wrongfully arrested, and a search turns up illegal contraband, that evidence is not automatically excluded because the rule is not to punish the public by allowing criminals to get off on easy technicalities, the rule is to deter misconduct, and a mistake or typographical error is not misconduct, such as a typographical error on a search warrant, in stead of 156 elm street it says 158 elm street, if a big drug raid is done, they can not have all the evidence thrown out because the officer or judicial officer writing the warrant hit the wrong key, this punishes the public for a misunderstanding or mistake. Theres also a whole separate set of rules for those on probation or parole, they have a much diminished expectation of privacy, and they can be searched for almost anything. Now keep in mind these rules change all the time, almost every year there is at least one major 4th amendment case that is a big change from prior rules. Theres rules for drug sniffing dogs, in some cases the courts have even gone as far as to look at the dogs test scoring to determine if the dogs indication is reliable, or if the dog just says yes to everything. You can go on and on, and on and still every 4th amendment case is it's own.
“The truth shall set you free.”