Hello,
the search root-scope object is only valid for Alfresco Repository server-side scripts. It is neither available on Alfresco Share server-side nor Alfresco Share client-side scripts. You are trying to access search in a client-side script of Share. I don't know what exactly you are trying to accomplish, but typically, you write a Repository server-side script as part of a "web script" that performs any search action and result presentation for your client-side script to call via AJAX either directly via the web script proxy or via a Share server-side script as part of a web script.
Regards
Axel