Ignorance of the law is no excuse... Except... A citizen with no legal training may be sent to prison for violating the most obscure federal law on the books. Nevertheless, a police officer with training in the law - and whose job it is to enforce the law - may escape civil liability even when he has violated the law. Thus, ignorance of the law is a defense - if you're a police officer who has been sued rather than a citizen who might go to prison. This is an odd contrast, given that prison is a worse sanction than a civil judgment (from which a police officer would be indemnified, anyway).
Ignorant experts... "[W]e have recognized that a law enforcement officer may rely on his training and experience to draw inferences and make deductions that might well elude an untrained person." Texas v. Brown, 460 U. S. 730, 747 (1981). The thinking goes like these: Police officers are highly trained individuals. Of course courts should defer to their expertise.
If officers are cable of attaining immune-from-judicial-inquiry training and experience, why should they be allowed to violate the Constitution? On the one hand, police are professionals. On the other hand, they are too stupid to comprehend civil rights law.Thus, a police officer is an expert in the law - except when he has been sued for a violation of the law.
Enforcing the law does not mean one must know the law. A police officer must have probable cause that a crime has been committed before he may arrest someone. Surely, then, police officers must be able to understand the law. How else could they enforce it? Arrests would be nothing more than a game of chance. "We arrested this guy because he looked funny. Not sure what to charge him with. Who am I, but a humble beat cop, to know the law?"
In one context (where recognizing expertise would credit an officer's testimony), courts suggest that police are perfectly capable of developing legal expertise. In other context (where police officers have violated the law), courts say that one cannot expect police officers to learn civil rights law.