I can’t get any search functions in silverstripe to work and I’m resorting to my last resort: google custom search. Yet, if I try to set up a search engine for my site, it doesn’t work. Currently, the site is in a subdirectory and I don’t think google custom search works with subdirectories. But even if I set it up from the root of the web server, it won’t find any results in the silverstripe subdirectory. Plus, I’ve tried setting the silverstripe page as a subdomain but it won’t work that way either. My question is, will silverstripe work with google custom search engine if the silverstripe site is as the root of my web server?
Yes it should work fine. I have used GCS on a SilverStripe site in the past although admittedly a few years back.
I don’t see why GCS should care whether SS is under a sub directory or not because GCS doesn’t have any knowledge about your website infrastructure, it just operates on Google’s index. If your website is live and it’s pages are indexed by Google then CSE should work okay. When you set up a CSE at https://cse.google.com/ you should be able to access a search form to test with - does that work? If not, you probably need to fix the issue with Google rather than SilverStripe by ensuring all of your pages are discoverable by Google and/or checking your CSE configuration.
I am very happy to help you get started.