Grouping search results by "Category" headers

Hi everyone, I’m trying to create a similar search to the one found in the Typescript website. Here you can see that there’s a main categories groupings (which are treated as lvl0), however they don’t seem to appear in the markup. While I can easily map results in the front end to a specific lvlX, I need to understand how to structure my document so I can properly scrape the content and fit a scenario where the headings are more like categories that don’t exist in the actual document. One way I can think of doing this is by including a heading class in each content page that I can hide from displaying using css but I’m hoping there’s a smarter way to do this that I’m not finding from the documentation.