How is Algolia search implemented on Hugo docs?

Continuing the discussion from How are you implementing site search:

Following the previous discussion about searching in Hugo, I noticed that Hugo Docs don’t use Google Custom search engine but Algolia. I was wondering if the person(s) who implemented this share how they approached this?

I see that the /data/ folder in the Hugo doc source doesn’t contain any data that Algolia accepts for the search engine, so I figure this is submitted ‘on the fly’ when the site is build?

1 Like

That’s because the search doesn’t depend on Hugo data files. Instead Algolia uses a custom crawler that indexes the website from time to time. The search index itself is stored and maintained by Algolia.

If you search something a Javascript snippet makes a request with your query to the servers of Algolia. Then the index is will be filtered to find the best matches. Those will be returned and displayed.

That’s interesting, and surprisingly too since that feature isn’t available on their free and commercial plans but something exclusive of their Docsearch program. That makes it outside of the scope of regular Hugo users, unfortunately.

Thanks for clarifying!