-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(v2): DocSearch should keep working after a new release (part 1/2) #3393
Conversation
…arch/Algolia, so that on new version publish, search still works even if new version is not already indexed (#3391)
Deploy preview for docusaurus-2 ready! Built with commit 5ec985c |
Deploy preview for docusaurus-2 ready! Built with commit bc7c88a |
website/docusaurus.config.js
Outdated
@@ -235,7 +235,7 @@ module.exports = { | |||
apiKey: '47ecd3b21be71c5822571b9f59e52544', | |||
indexName: 'docusaurus-2', | |||
searchParameters: { | |||
facetFilters: [`version:${versions[0]}`], | |||
facetFilters: [`version:last`], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change will make the search filters only on one version. The "last"
one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is what we want no?
We already filtered on versions[0]
anyway
So it means we had facetFilters: ["version:2.0.0-alpha.62"],
and now we'll have this facetFilters: ["version:last"],
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually we would like the searchParameters to be injected from the version of the page you search on.
The current behaviour is not what we would expect. For example, searching on the page 2.0.0-alpha.58
filters on the latest version (alpha 62) while we would like to filter on the alpha 58.
Would it be possible to filter on the version of the page instead of only the latest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@s-pace this is something we discussed with @francoischalifour already but we'll do that later.
Historically we only search in the last version. This PR only focus on not breaking search on new publish, due to the facetFilter changing name.
"contextual search" is more complicated to handle. We now support multiple docs plugin instances on same site, (like ios sdk 1.0/2.0 while android sdk is 1.0/1.1/1.2 etc...) so we should figure out a contextual search experience that account for this. Will be done in another PR later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that we keep track of this, opened an issue: #3396
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a temporary solution you could also try the optionalFilters
search parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, don't know much about Algolia apis :)
But this affects scoring yet would still allow to display duplicate results no? For example if a query match only 1 doc of each version, you'll still end up with results showing the same doc in multiple versions? I mean it just "boost" the score of one specific version right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm yes sorry, I just checked and it's not supported on the DocSearch plan anyway.
Motivation
If we are v2 and release v3, using a version:v3 facet will not retrieve any result until the new version is indexed.
By using a constant alias like version:last, we should still be able to search v2 docs before v3 docs are indexed
Should fix #3391
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Tests + deploy preview + next release