rtd_enhanced_search.js hits v3 API without version, RTD returns stable results on non-stable builds

Open
#327 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
javascript

Research direction

Start with src/sunpy_sphinx_theme/theme/sunpy/static/js/rtd_enhanced_search.js and trace how the search request is built, how loaded RTD Addons metadata is read, and how later metadata updates are handled. Reproduce a search on a non-default documentation build; done means only the viewed project is version-pinned, external PR builds and unavailable metadata preserve existing behavior, and other projects retain their default versions.

Written by the indexing model from the issue text.

Description

In src/sunpy_sphinx_theme/theme/sunpy/static/js/rtd_enhanced_search.js, searches on indexed non-default documentation versions return results from the project’s default version, usually stable.

This affects projects using the SunPy theme, including Astropy through the Astropy unified theme. See astropy/astropy#19866.

Reproduction:

  1. Open an indexed non-default build, such as /en/latest/ or a tagged release.
  2. Run a documentation search.
  3. Results link to /en/stable/.

The RTD v3 search API ignores a separate &version=<slug> parameter. Version filtering must be included in q using project:<slug>/<version>.

The fix should:

  • Pin only the currently viewed project.
  • Leave other projects on their default versions.
  • Read already-loaded RTD Addons metadata and listen for later updates.
  • Avoid pinning external PR builds, which are not indexed.
  • Preserve existing behavior when RTD metadata is unavailable.
Dominant language
JavaScript
Stars
7
Forks
17
Avg merge
1d 13h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sunpy/sunpy-sphinx-theme

All issues in sunpy/sunpy-sphinx-theme

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.