algolia / sphinx-docsearch

Add Algolia DocSearch to your Sphinx documentation project
https://sphinx-docsearch.readthedocs.io/
MIT License
12 stars 1 forks source link

The list of search results always point to the `latest` documentation. Is there a way to handle search queries for multiple versions? #38

Open peytondmurray opened 1 week ago

peytondmurray commented 1 week ago

I'm using sphinx-docsearch to provide search results for pydata-sphinx-theme-themed documentation. The documentation is hosted on ReadTheDocs, and we're using RTD to host multiple versions of the documentation.

When I enable sphinx-docsearch, all the results point to the latest version (i.e. https://my-docs.com/en/latest/, even if I'm searching from a different version of the docs. How do I configure sphinx-docsearch to return only results from the version of the docs I'm currently looking at?

For local development replacing the base url with relative URLs instead of the latest docs would be helpful as well.

kai687 commented 1 week ago

Hi @peytondmurray,

The issue with versioning is a good one. Need to think about that.

For local development replacing the base url with relative URLs instead of the latest docs would be helpful as well.

Not sure if that's possible since the DocSearch crawler only indexes the published website, and it can't access your local files.

kai687 commented 1 week ago

Do you have a sitemap with all your URLs? That would make it fairly straightforward to discover all URLs for all versions.