Skip to content
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

Merged
merged 4 commits into from
Sep 3, 2020

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Sep 2, 2020

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

…arch/Algolia, so that on new version publish, search still works even if new version is not already indexed (#3391)
@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label Sep 2, 2020
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Sep 2, 2020
@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-2 ready!

Built with commit 5ec985c

https://deploy-preview-3393--docusaurus-2.netlify.app

@docusaurus-bot
Copy link
Contributor

docusaurus-bot commented Sep 2, 2020

Deploy preview for docusaurus-2 ready!

Built with commit bc7c88a

https://deploy-preview-3393--docusaurus-2.netlify.app

@@ -235,7 +235,7 @@ module.exports = {
apiKey: '47ecd3b21be71c5822571b9f59e52544',
indexName: 'docusaurus-2',
searchParameters: {
facetFilters: [`version:${versions[0]}`],
facetFilters: [`version:last`],
Copy link

@s-pace s-pace Sep 2, 2020

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.

Copy link
Collaborator Author

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"],

Copy link

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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

Copy link
Contributor

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.

Copy link
Collaborator Author

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?

Copy link
Contributor

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.

@slorber slorber marked this pull request as ready for review September 3, 2020 12:32
@slorber slorber merged commit 9c34f68 into master Sep 3, 2020
@slorber slorber changed the title fix(v2): DocSearch should keep working after a new release fix(v2): DocSearch should keep working after a new release (part1/2) Sep 3, 2020
@slorber slorber changed the title fix(v2): DocSearch should keep working after a new release (part1/2) fix(v2): DocSearch should keep working after a new release (part 1/2) Sep 3, 2020
s-pace pushed a commit to algolia/docsearch-configs that referenced this pull request Sep 3, 2020
@lex111 lex111 deleted the slorber/algolia-latest-facet branch October 7, 2020 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Algolia search broken after new release
5 participants