pdoc3 / pdoc

:snake: :arrow_right: :scroll: Auto-generate API documentation for Python projects
https://pdoc3.github.io/pdoc/
GNU Affero General Public License v3.0
1.14k stars 146 forks source link

Cannot get search to work #448

Closed aflugge closed 4 months ago

aflugge commented 4 months ago

Expected Behavior

After running in the project directory pdoc3 --html --force -c lunr_search=True . I expect to be able to have a working search box in my HTML documenation files.

Actual Behavior

I get the following error message:

Traceback (most recent call last):
  File "projectfolder/.venv/bin/pdoc3", line 8, in <module>
    sys.exit(main())
  File "projectfolder/.venv/lib/python3.10/site-packages/pdoc/cli.py", line 609, in main
    modules, lunr_config.get("index_docstrings", True), template_config)
AttributeError: 'bool' object has no attribute 'get'

The HTML files have a search box, but if I try to search something, I get the following error message in my browser:

File not found

Firefox can’t find the file at projectfolder/html/doc-search.html#searchWord.

    Check the file name for capitalisation or other typing errors.
    Check to see if the file was moved, renamed or deleted.

There is no doc-search.html in the html folder.

If I run the pdoc3 command without -c lunr_search=True it runs without error, it creates the documentation, but it doesn't put a search box in the documentation.

Additional info

aflugge commented 4 months ago

Nevermind. Switched to pdoc, that seems to work.

kernc commented 4 months ago

lunr_search= param is expected to be a dict, not bool: https://github.com/pdoc3/pdoc/blob/2a66eb2c882cabd195a61f44a921bfdc39eddf2e/pdoc/templates/config.mako#L51-L56