Skip to content

templates: add cross-project search using ReadTheDocs API - #319

Merged
mergify[bot] merged 1 commit into
flux-framework:masterfrom
grondo:cross-project-search
Apr 16, 2026
Merged

templates: add cross-project search using ReadTheDocs API#319
mergify[bot] merged 1 commit into
flux-framework:masterfrom
grondo:cross-project-search

Conversation

@grondo

@grondo grondo commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Problem: The sphinx_immaterial theme uses client-side search that only searches the local project's searchindex.js file. Even though flux-docs and its subprojects (flux-core, flux-sched, flux-security, flux-rfc) are configured in ReadTheDocs as a project family, users cannot search across all documentation from the main site.

Solution: Override sphinx_immaterial's partials/search.html template to use ReadTheDocs' server-side search API with the subprojects=true parameter when on RTD (falls back to standard theme search for local builds). Add on_rtd to html_context in conf.py so it's available in templates. The custom search queries all configured subprojects and displays results with project labels (e.g., [core], [sched]).

The only way to check if this works is to let RTD build this PR and check if search is working in the preview.

Problem: The sphinx_immaterial theme uses client-side search that
only searches the local project's searchindex.js file. Even though
flux-docs and its subprojects (flux-core, flux-sched, flux-security,
flux-rfc) are configured in ReadTheDocs as a project family, users
cannot search across all documentation from the main site.

Solution: Override sphinx_immaterial's partials/search.html template
to use ReadTheDocs' server-side search API with the subprojects=true
parameter when on RTD (falls back to standard theme search for local
builds). Use the relative API endpoint (/_/api/v3/search/) to avoid
CORS issues. Add on_rtd to html_context in conf.py so it's available
in templates. The custom search queries all configured subprojects
and displays results with project labels (e.g., [core], [sched]).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@grondo

grondo commented Apr 15, 2026

Copy link
Copy Markdown
Contributor Author

Ok, that didn't quite work. I'll be iterating here until it works.

@grondo
grondo force-pushed the cross-project-search branch from 82d5de3 to 03da0e0 Compare April 15, 2026 17:49
@grondo

grondo commented Apr 15, 2026

Copy link
Copy Markdown
Contributor Author

Ok, the changes "work" but we can't test the cross-site search functionality until this is merged.

@grondo
grondo requested review from wihobbs April 15, 2026 23:28

@garlick garlick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well let's give it a try then!

@grondo grondo added the merge-when-passing mark PR for auto-merging by mergify.io bot label Apr 16, 2026
@mergify

mergify Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-04-16 01:40 UTC · Rule: default
  • Checks skipped · PR is already up-to-date
  • Merged2026-04-16 01:40 UTC · at 03da0e0adb8ff326803170108cca1d0096087a35

This pull request spent 8 seconds in the queue, including 1 second running CI.

Required conditions to merge
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = docs/readthedocs.org:flux-framework
    • check-neutral = docs/readthedocs.org:flux-framework
    • check-skipped = docs/readthedocs.org:flux-framework
  • any of [🛡 GitHub branch protection]:
    • check-success = ensure latest examples built
    • check-neutral = ensure latest examples built
    • check-skipped = ensure latest examples built
  • any of [🛡 GitHub branch protection]:
    • check-success = spell-and-linkcheck
    • check-neutral = spell-and-linkcheck
    • check-skipped = spell-and-linkcheck
  • any of [🛡 GitHub branch protection]:
    • check-success = validate commits
    • check-neutral = validate commits
    • check-skipped = validate commits

@mergify mergify Bot added the queued label Apr 16, 2026
@mergify
mergify Bot merged commit 03b8125 into flux-framework:master Apr 16, 2026
7 of 8 checks passed
@mergify mergify Bot removed the queued label Apr 16, 2026
@grondo
grondo deleted the cross-project-search branch April 16, 2026 01:41
@grondo

grondo commented Apr 16, 2026

Copy link
Copy Markdown
Contributor Author

Didn't seem to work 😞 I'll keep poking at it. It seems to use the right request to readthedocs so maybe something is not configured correctly there.

@vsoch

vsoch commented Apr 16, 2026

Copy link
Copy Markdown
Member

It is the Django REST Framework. So you can likely just use: https://app.readthedocs.org/api/v3/

I'm not sure we can assume that the API is being served from the node where the static site lives (did an LLM suggest that?) It's not a design that makes a lot of sense, unless readthedocs is a monolithic architecture. My suggestion is to use the above to get the exposed API. It will work for development too.

And you can find the source code here: https://github.com/readthedocs/readthedocs.org/blob/603b87bbd69071a8ad80b16c9f09543da24b6ff0/readthedocs/search/api/v3/views.py#L168

Django (and Django REST) is really great! It was always my choice for APIs.

@vsoch

vsoch commented Apr 16, 2026

Copy link
Copy Markdown
Member

But hold the phone - are you sure the "not working" isn't a lab thing? It looks like it's working here! 🎉

image

Landing page looks great, by the way!

@grondo

grondo commented Apr 16, 2026

Copy link
Copy Markdown
Contributor Author

Oops sorry @vsoch I missed these comments! We switched to the strategy in #320 which seems to be working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-when-passing mark PR for auto-merging by mergify.io bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants