Prompts are making their way into docs websites, as a useful complement to instant search for surfacing information. Perhaps because of their conversational nature, they are often presented via a chat bubble, sitting at the bottom corner of the screen, and could be mistaken for a support chat.
We experimented with putting the prompt closer to the regular search, by combining them both in a single tab-based interface. The idea is that in both scenarios, you are looking for a piece of information, and a unified search bar provides the shortest mental path to get to an answer.
Introducing the Algolia DocSearch integration
Now, the prompt interface has a new search tab, and users can seamlessly switch between the two "modes", including by hitting Cmd/Ctrl Enter.
In Docusaurus, just add the Algolia keys to your Markprompt configuraton in
Read more about search options in our documentation.
Setting up Algolia in the playground
We made it easy to add Algolia directly in the playground, so you can try it out without having to set up any project. Just toggle on "Instant search", choose Algolia as the provider, and enter your configuration keys.
Mapping Algolia properties
Depending on how your Algolia index is set up, you may need to provide mappings between search results from Algolia and Markprompt. These mappings define what is displayed in the heading, title and subtitle of a search result, as well as the link to navigate to. Say your Algolia index returns search results of the shape:
These custom properties can be mapped to Markprompt using the
getSubtitle callbacks. In our React example above, here is how it would look:
Using with other search providers
If you are using other search providers, such as FlexSearch or Fuse.js, our headless component allows you to seamlessly combine your existing search UI with the Markprompt UI. This is similar to what you would do with a headless component library like Radix UI (which Markprompt is based on).
Check out the Markprompt React repository on GitHub for a list of headless components that are provided for you to build a custom search and prompt UI.
We would love your thoughts, and we warmly welcome PRs to support other search providers.