I doubt the searches themselves are illegal. Presumably those officers have legal access to those databases. It might be illegal to disclose the information to a civilian, and at the very least I hope it is against department rules.
Also not clear what kind of searches those are. It sounds like it could have been public records of ongoing court cases.
I suppose the question to ask is who reviews these types of talks (no doubt many agents talk to PIs etc.) to make sure nothing illegal is happening.