Search code examples
searchalgoliadocusaurus

Testing the index using the browse tab gives no results


I'm trying to integrate Algolia with Docusaurus. I created a crawler using the Docusaurus Algolia v2 example and created an index after running it. In the Algolia web, when I test the index using the browse tab, it seems to bring results as expected, but in Docusaurus, there are no results.

themeConfig:
    /** @type {import('@docusaurus/preset-classic').ThemeConfig} */
    ({
      algolia: {
        appId: 'XXXXXXX',
        apiKey: 'YYYYYYYYYYYYYY',
        indexName: 'ZZZZZ',
        contextualSearch: true,
      },

Solution

  • This is what fixed it for me:

    1. Delete the index in the https://www.algolia.com --> Data Sources --> Your index
    2. Visit the crawler portal (https://crawler.algolia.com/), select the default crawler, and edit the code. Use the Docusaurus v2 template. Make sure that you use a new index name, not the one that you have just deleted.
    3. Run the crawler from crawler.algolia.com
    4. Check that the index is now created
    5. Also check that in the left side of the "browse" tab in the index you can see a menu with checkboxes, including "docusaurus_tag" and "lang". If you don't see these something went wrong.
    6. Re-deploy your Docusaurus site.

    I found some similar answers online but they failed. For me the key was using a new index name. That was the only way create the index correctly and get to see the "docusaurus_tag" checkbox.