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.12k stars 145 forks source link

Lunr search with --http mode #295

Open al-pa opened 3 years ago

al-pa commented 3 years ago

Hello, When I tried to use offline search functionality I get such error in pop-up window:

Error importing module doc-search:

Traceback (most recent call last):
  File "/home/al-pa/localPython/py380/lib/python3.8/site-packages/pdoc/__init__.py", line 225, in import_module
    module = importlib.import_module(module_path)
  File "/home/al-pa/localPython/py380/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'doc-search'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/al-pa/localPython/py380/lib/python3.8/site-packages/pdoc/cli.py", line 234, in do_GET
    out = self.html()
  File "/home/al-pa/localPython/py380/lib/python3.8/site-packages/pdoc/cli.py", line 263, in html
    return pdoc.html(self.import_path_from_req_url,
  File "/home/al-pa/localPython/py380/lib/python3.8/site-packages/pdoc/__init__.py", line 176, in html
    mod = Module(import_module(module_name, reload=reload),
  File "/home/al-pa/localPython/py380/lib/python3.8/site-packages/pdoc/__init__.py", line 227, in import_module
    raise ImportError('Error importing {!r}: {}: {}'
ImportError: Error importing 'doc-search': ModuleNotFoundError: No module named 'doc-search'

pip install doc-search tells me that ERROR: Could not find a version that satisfies the requirement doc-search ERROR: No matching distribution found for doc-search

Could you please help me to understand what I am missing?

P.S.

$ python --version
Python 3.8.0

$ pdoc --version
pdoc 0.9.2

$ pip --version
pip 20.3.3 from /home/al-pa/localPython/py380/lib/python3.8/site-packages/pip (python 3.8)

P.P.S. running pdoc with such command: pdoc3 --html --http localhost:1234 -c lunr_search=True <module_name>

Thank you!

kernc commented 3 years ago

Lunr-based search index/machinery is only set up when --html, but not when --http, the two of which are exclusive: https://github.com/pdoc3/pdoc/blob/bec63077a03b2136e6982825d327073ed76cc20a/pdoc/cli.py#L500-L523 https://github.com/pdoc3/pdoc/blob/bec63077a03b2136e6982825d327073ed76cc20a/pdoc/cli.py#L570-L585

JanPalasek commented 2 years ago

Doesn't work both with --html and --http , if I use it separately. How should we use it? I couldn't find any docs to that.