You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Contextual doc version search (Algolia/DocSearch) #3396
This works, but also has some drawbacks: if you are currently browsing v1, and last version is v2, when you search, you will find v2 results.
We should make this facetting behavior contextual/dynamic, instead of being hardcoded in the site config, and if user is currently browsing v1, we should facet on v1, show him v1 related results.
Note: the solution must play well with docs multi-instance support. If you have:
Android SDK in version v1, v2, v3
iOS SDK in version v4, v5, v6
What should happen if:
you type some Android related keyword while you are browsing iOS doc?
you are not browsing any doc at all (ie you are on the homepage, the blog?)
Is this related to V2? I'm currently using V1 and it works the way you explained it should. Whichever version of documents I am on, the search results are from that version only.
@amimas according to what I see, yes contextual search works on v1, but not on v2.
I see this code on v1 responsible for contextual doc search:
For v2 we'll need something similar, but also take into account docs multi-instance, and maybe it's worth to add the possibility to search non-docs things (blog posts, pages), as it seems currently unsupported on v1.
Important to consider: if we persist a "preferred version" we probably should search in this version when searching on unversioned pages (see also #3543)
Sounds like a neat feature. I am actually doing something like this using V1 already. I have separate Docusaurus V1 instances for different tools and they are all deployed at subfolder from the root of the domain. Each docusaurus instance has its own versioning and search index with algolia. As a result, when you are in a page doing a search, the search is already contextual based on the tool and the version being viewed. A landing page at the root is deployed using another generator that brings the whole site together.
Anyways, if we have "multi-instance" docs in V2, then yes, that should be in the consideration of contextual search.
Great, hope we'll be able to solve your usecase.
Although if you have large sites to assemble it may be better to keep them separated to avoid long build times.
There's already a PR here: #3543, but waiting for Algolia inputs to complete it.
Activity
amimas commentedon Sep 17, 2020
Is this related to V2? I'm currently using V1 and it works the way you explained it should. Whichever version of documents I am on, the search results are from that version only.
slorber commentedon Sep 29, 2020
@amimas according to what I see, yes contextual search works on v1, but not on v2.
I see this code on v1 responsible for contextual doc search:
For v2 we'll need something similar, but also take into account docs multi-instance, and maybe it's worth to add the possibility to search non-docs things (blog posts, pages), as it seems currently unsupported on v1.
slorber commentedon Oct 6, 2020
Important to consider: if we persist a "preferred version" we probably should search in this version when searching on unversioned pages (see also #3543)
amimas commentedon Oct 11, 2020
Not sure what is "docs multi-instance" @slorber .
slorber commentedon Oct 12, 2020
@amimas not well documented yet but you can understand the idea here: #3299
One Docusaurus site can host the doc for 2 sdks (like ios + android) that have different versions/release cycles.
amimas commentedon Oct 12, 2020
Thanks for the reference @slorber .
Sounds like a neat feature. I am actually doing something like this using V1 already. I have separate Docusaurus V1 instances for different tools and they are all deployed at subfolder from the root of the domain. Each docusaurus instance has its own versioning and search index with algolia. As a result, when you are in a page doing a search, the search is already contextual based on the tool and the version being viewed. A landing page at the root is deployed using another generator that brings the whole site together.
Anyways, if we have "multi-instance" docs in V2, then yes, that should be in the consideration of contextual search.
slorber commentedon Oct 12, 2020
Great, hope we'll be able to solve your usecase.
Although if you have large sites to assemble it may be better to keep them separated to avoid long build times.
There's already a PR here: #3543, but waiting for Algolia inputs to complete it.