[Bug]: unable to load search index if base ends with /vX.Y.Z/
docmd version
0.9.8
Node.js version
v24.18.1
OS/Browser
macOS / Safari
Description
When I use url like http://localhost:3000/dir1/dir2/dir3/ and base /dir1/dir2/dir3/, everything works (access to pages, okf files generated...).
When dir3 is vX.Y.Z, pages are all ok but system fails to load search index since it tries to load it relative to /dir1/dir2/ instead of /dir1/dir2/vX.Y.Z/
When dir3 is a number 12345678, search works.
Steps to Reproduce
dockmd init- edit docmd.config.json to set url and base /dir1/dir2/vX.Y.Z/
- npm build
- deploy site under defined base
- enter the search zone and you get a "failed to load search index"
If base/url include vX.Y.Z, vX.Y.Z-preXX, browser fails to load search index since it tries to fetch it from /dir/dir2/_docmd-search/search-index.json instead of /dir1/dir2/vX.Y.Z/_docmd-search/search-index.json
Expected Behavior
Ensure in search plugin that any value provided for url and base are working
Found possible culprit in plugin search code: https://github.com/docmd-io/docmd/blob/main/packages/plugins/search/src/client.ts#L74-L93
I guess this was done to handle a documentation being multi-version: my doc is mono-version but exposed on a path containing /vX.Y.Z
Hi,
Thank you for reporting this issue.
This has been resolved in v0.9.9 via PR #266. Search index resolution now respects version-like directory prefixes without stripping base path segments.