A broken tail light, by itself, is not a sufficient basis to search a vehicle. Consult directly with an experienced CA defense lawyer if you are being charged or wish to pursue this issue further. Good luck.
DISCLAIMER I do not practice law in your State. This answer is provided solely for informational purposes only. This answer does not constitute legal advice, create an attorney-client relationship, or constitute attorney advertising.