Docusaurus x Algolia x Netlify - Not crawling hierarchy

Hi everyone,

I’m having some issues when using the search on my documentation.

I’m using Docusaurus v2 with docusaurus/theme-search-algolia deploying in Netlify with a custom domain.
The website code is on GitHub, so every time a commit is done for “Master”, a new build is triggered.

I’ve enable the Algolia crawler plugin and when it builds the website, it runs the crawler successfully since I can see new records being added to the index.
However my issue is that when I try to search I got an error.
“Uncaught (in promise) TypeError: Cannot read property ‘lvl0’ of undefined”

Has anyone had this problem or similar?
Could it be a misconfiguration in my website config?

Thank you!

Hey @operations1

Are you able to share your site/repo?

Hi @the ,
Of course:
GitHub Repo - GitHub - SkillsWorkflow/Documentation

Website -

I’m adding an record example of what I see on my index.


So I haven’t come up with anything conclusive (other than I am unlikely to use this myself.)

Using your search credentials I was able to perform a successful search via cURL. From this I can tell there is nothing wrong with your credentials.

curl -X GET \
     -H "X-Algolia-API-Key: {apiKey}" \
     -H "X-Algolia-Application-Id: {appID}" \

One of the things I noted on the @docusaurus/theme-search-algolia page is it provides a /search page. This is very much broken; as soon as a single character is entered into the search box focus is removed. This is no use to anyone (especially the user.) There is an open issue for /search Docusaurus sends incorrect Algolia DocSearch request under /search · Issue #5084 · facebook/docusaurus · GitHub which is possibly related.

On a demo React/Netlify CMS site I have Algolia crawler running with Instantsearch via CDN and it works great.

I suggest this is not misconfiguration on your part. There are several open issues on docusaurus with regards algolia.

Hi @the ,
I was able to crawl the hierarchy by adding a netlify.toml

package = "@algolia/netlify-plugin-crawler"
  template = "hierarchical"

However, the search is returning values, but it looks that it is not able to find the values/titles to display.
i.e. the class ‘DocSearch-Hit-content-wrapper’ and its contents are not being added

Any advise on this?


What I can see is the error

Uncaught (in promise) TypeError: Cannot read property 'value' of undefined

which is caused by the line

var t = (e._highlightResult
    ? e._highlightResult.hierarchy.lvl0
    : e.__docsearch_parent._highlightResult.hierarchy.lvl0).value;

In the same script is

attributesToRetrieve: [

but it would appear from the screenshot of your data previously posted, you have no hierarchy data attribute to retrieve (unless that has now changed with the new crawl.)

Yes, the new crawl got the hierarchy, however not sure why the “type” is not there.
On the example below I got the hierarchy levels: lvl0, 1 and 2.

I think I’ve figured it out. That’s not to say I have the solution.

I still see an error in the console, hierarchy is certainly returned in the data.

But this is the real issue

which you want to look like this

Results are populating the spaces however you have an SVG in place of text

When you probably want it to look like this

1 Like


Thanks for the thorough report I’ll get in touch with the docsearch team as it seems to be coming from the frontend

1 Like

I’ve also found out that when setting contextualSearch: true, the search results are 0.

  • Language metadata on my index is crawled as “lang”
  • On the API call from my website it is passed on the facetFilters “language” and 2 additonal defaults one

Should I configure anything else on my netlify.toml file so that:

  • Language is correctly crawled
  • Remove “docusaurus_tag:default” and “docusaurus_tag:docs-default-current” facetFilters from contextual search since it would be required to have the ContextualSearch for the language filtering purpose

Hi Samuel, any update on this ? Let me know if you need further information from my side. Thank you :slight_smile: