Docsearch UI widget

Hi folks,

A few days ago I started looking closely into Algolia as I have a website using Hugo and Docsy. Originally I wanted to use Docsearch but later realized it’s only open to open source projects as explained in the Docsy and Algolia docs.

However, is there an easy way for me to incorporate the DocSearch cool UI widget into a private owned Algolia account which doesn’t use the crawler?

I understand I could use the legacy Docsearch for this, but I wanted to avoid this option since it’s not maintained anymore.

Thank you!

Hi @jmichelgarcia

I’m glad you like the DocSearch widget! The coolest thing about DocSearch is it’s all built on top standard Algolia components – the Crawler for ingesting your site and our Autocomplete library for the front end.

You can absolutely use the DocSearch widget with your own index, but keep in mind that it is opinionated about the shape of your index records and you’ll need to follow that schema closely when you populate your index.

We also have a blog post on building your own version of the DocSearch UI from the Autocomplete widget:

This might be more flexible for getting something that will work with your account.

Thank you, I will have a look!

I don’t like the crawler idea because I use Hugo. I’m already iterating over all existing pages today during the build (to build sitemap, rss, etc), so that feels the right time to build a json index.

1 Like

It would be nice to have this

it is opinionated about the shape of your index records

Clearly documented/outlined somewhere. The article you shared goes in depth to explain how to replicate the widget. However, the information I’m after is, what is the index structure that docsearch expects (the one the crawler outputs).

1 Like

That’s good feedback. It’s probably not a common ask since people tend to use the component with a Docsearch index, but I’ll pass it on to the team.

In the meantime, you can see the shape of the records by looking at the Hit template in the source code:

@jmichelgarcia The crawler indexes every page, heading, and paragraph of a docs site. It will be difficult to replicate this perfectly in Hugo.

Related: What's the recommended approach to recreate DocSearch records

1 Like