Setting a hierarchy filter via script

In the top of the Hierarchy window of the Unity Editor there is a field for filtering the hierarchy: My question is if you can set that filter from an editor script and how. I can barely find anyt...