That an official government document explicitly mentioning that school staff is allowed to search a device without law enforcement (either being present, or authorized by warrant) is problematic in and of itself.
You can decline this at any age. What can they do? Well turns out at that point they can only threaten to or apply violence or confiscate it until you hand over the details, none of which are "reasonable in all circumstances" as quoted in the legislation.
So the correct answer is to tell your kids to tell them to get fucked and call you. At that point, remind them that the device is your property, decline their request and they can only threaten you, which is 100% illegal.
I am more worried about the teachers from experience than the other students. Some of them I have encountered over the last 15 years of having three kids at school have been right nasty pieces of work and should not be in a position to have power over a minor.
I agree that teachers should be able to enforce discipline in schools.
With that said, I've got no idea what schools should do about things like sexting.
If I was a teacher and I confiscated a phone which might have illegal photos of underage students on it, I wouldn't want to turn a blind eye to that. But I also sure as hell wouldn't want to search it myself. I'd want that done by someone of unimpeachable character.
of course, in case of explicit images, i 100% agree. escalated straight to head of the school/department, who is detached from the situation and has a process to follow (presumably involving authorities)
One of my sons schools had a case where someone was suspected, and from my understanding the school spoke to the police about it, and given the lack of any concrete evidence against one specific they, opted to send out a school-wide e-mail encouraging parents to talk to their kids and check their phone instead. Not a funny e-mail to get but frankly I'd rather that than find a random teacher had been tasked with it on the basis of suspicion that someone in school had been spreading something.