Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lunr search doesn't work for generated docs #349

Closed
Diveafall opened this issue Aug 2, 2021 · 2 comments
Closed

Lunr search doesn't work for generated docs #349

Diveafall opened this issue Aug 2, 2021 · 2 comments
Labels
invalid This is not a (valid) bug report

Comments

@Diveafall
Copy link

Expected Behavior

I have successfully generated documentation and I want to add offline search to it. After adding lunr_search = {'fuzziness': 1, 'index_docstrings': True} to my config.mako it works fine when opened using index.html inside the module subdirectory. However, when I serve the documentation on Netlify or even locally using serve the iframe for the search results point to a file inside a parent directory resulting in a 404 page.

Actual Behavior

Search should work for documentation out of the box.

Steps to Reproduce

  1. Generate documentation for the module: pdoc --html --output-dir api_docs --template-dir pdoc/templates hub
  2. Serve generated documentation from inside api_docs/hub
  3. Search for anything

Additional info

The problem here is obviously that doc-search.html resides above the served site. How can this problem be solved?

  • pdoc version: 0.9.2
@jwcarr
Copy link

jwcarr commented Aug 14, 2021

I'm also having this issue, which seems to have been introduced in version 0.9.2. Prior to that, the search resources were placed in the module subdirectory, but now they are placed in the docs/ directory. This is a problem if you a serving the website from docs/module/ because higher-level resources will not be publicly accessible.

Not sure what the appropriate behavior should be — I presume there was a good reason why the search resources were moved up one level. Seems to be related to #250 and 2e08bd8

@kernc
Copy link
Member

kernc commented Aug 16, 2021

The recommended workaround is to instead:

  1. Serve generated documentation from inside api_docs

and put up a doorway page such as #55 (comment).

Also related to #101, #233.

@kernc kernc closed this as completed Aug 16, 2021
@kernc kernc added the invalid This is not a (valid) bug report label Aug 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This is not a (valid) bug report
Development

No branches or pull requests

3 participants