praveenn77/docusaurus-lunr-search

Provide a configuration to specify baseUrl or path to generated Search/Lunr JSON files

nobeh opened this issue · 3 comments

nobeh commented

When the plugin is being loaded, it uses siteConfig from docusaurus:

https://github.com/praveenn77/docusaurus-lunr-search/blob/main/src/theme/SearchBar/index.jsx#L15-L16

which defaults to baseUrl and this is used to load the generated JSON files:

https://github.com/praveenn77/docusaurus-lunr-search/blob/main/src/theme/SearchBar/index.jsx#L55-L57

This assumes that the same directory/file structure is accessible after deployment. However, imagine that the deployment would be in such a way that the /search-doc.json would be accessible via /assets/search-doc.json.

It'd be great if the baseUrl (or filenames.{searchDoc, lunrIndex}) would be a configuration so that the user could specify on how to load them on different environments.

nobeh commented

Seems to be also related to a similar issue at #80

assetUrl option added in new version 3.1.0.
Thanks

nobeh commented

Thanks for your support on this 😍