praveenn77 / docusaurus-lunr-search

Local / Offline Search for docusaurus
https://praveenn77.github.io/docusaurus-lunr-search-demo/
MIT License
478 stars 80 forks source link

Search result doesn't have URI fragment link #147

Open jmthomas opened 4 months ago

jmthomas commented 4 months ago

I'm using docusaurus and this plugin on our site: https://docs.openc3.com/docs. Search works well but the link always just links to the base page and doesn't add the URI fragment that links to the actual text. For example searching for ID_ITEM will generate a result with a link of https://docs.openc3.com/docs/configuration/telemetry##. The double hashes seem to indicate that the URI fragment wants to be there but it's not.

Our full configuration is here: https://github.com/OpenC3/cosmos/tree/main/docs.openc3.com and the generated site is here: https://github.com/OpenC3/cosmos/tree/main/docs

I'm not doing anything special to configure the plugin. Just added it to the package.json dependencies and to the docusaurus.config.js in the plugins section.

paolochang commented 4 months ago

Hi @jmthomas ,

I also found this bug on our documentation site.

Search a page works as expected, but search by a subheader (h2, h3) in the page doesn't work. I also get double # at the end of the url. For example, if I search by the keyword "downloads", the url will be /dashboard/overview##

I found the incorrect url generated in search-doc.json. Please check the image below:

image

I'm using "docusaurus-lunr-search": "^2.3.2", and swizzled to update the css only.