Docsearch - scrape locally but run on a website

I’ve installed Docsearch locally to scrape and index my Jekyll-based site locally. The start_urls in the config are pointing to http://localhost:<port>/doc but I would like to use the docsearch on a private site which would have the URL of the form https://www.example.com/doc.

Is it even possible? If yes, how should I configure the client side of docsearch so that I can use docsearch on the private site URL, which would be a different from the localhost URL where the site was scraped from?

See this message for the answer.