Open mattip opened 4 years ago
I see the generated searchindex.js
file calls the setIndex
function in searchtools.js
. Could that be tweaked to become extendIndex
, and we could set the page headers to load the searchindex.js
of all the relevant affiliated sites.
I think I will try:
setAffiliate
function, which appends the affiliate's index
(push
es) to an this._affiliates
list, with an additional rootUrl
attributeperformTermsSearch
and performObjectSearch
to accept an index
and a rootUrl
which is DOCUMENT_OPTIONS.URL_ROOT
by defaultthis_index
call to the performTermsSearch
and performObjectSearch
, add a loop to iterate over all the this_affiliates
indices.It works in a prototype with [this diff] (https://gist.github.com/mattip/75f97b4cbf639d892af47be49c468fe9) where I manually edit the relevant affiliated searchindex.js
to (1) change the function name (2) add the rootUrl
, and (3) add it to search.html
. The only thing I haven't worked out yet is how to delay/redo the query to accomodate for network delays in loading the affiliate data, like delayQuery
.
I am turning these ideas into a sphinx extension in mattip/sphinx-affiliates.
PyTorch uses sphinx to build pytorch docs, torch audio docs, torch text docs, torch vision docs and a few more. It would be nice if search were aggregated across all the different separate sphinx doc sites.
I think the
IndexBuilder
could be fed theobjects.inv
intersphinx index from the other sites. The javascript would need to change a bit to accommodate a possibly different link base for the page.One alternative would be to use search from something like Algolia, as proposed in this issue for numpy.
Any thoughts or hints? Could this be done as an extension so it could be adapted independently of Sphinx?