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

Algolia search broken after new release #3391

Closed
slorber opened this issue Sep 2, 2020 · 4 comments · Fixed by #3393
Closed

Algolia search broken after new release #3391

slorber opened this issue Sep 2, 2020 · 4 comments · Fixed by #3393
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@slorber
Copy link
Collaborator

slorber commented Sep 2, 2020

🐛 Bug Report

Everytime we publish a new Docusaurus release, the Algolia search fets broken for a while, until the new version is indexed.

@s-pace said:

@Sebastien Lorber the docusaurus v2 website is now crawled every 24h. For informative purposes only, the crawl is happening from 6AM to 10AM CEST. 

The search breaks every-time there is a new release because it creates a new version. This version is extracted from the DocSearch meta tags by the crawler. This new version needs to be indexed first before to be searchable.

@francoischalifour said a temporary solution would be to send an empty PR to https://github.com/algolia/docsearch-configs/blob/master/configs/docusaurus-2.json: as they merge it, it would trigger site reindexation


This problem is likely because we use a new facet due to the new release:

      searchParameters: {
        facetFilters: [`version:${versions[0]}`],
      },

I think we should find a way to keep the facet filter constant so that search does not break.


Implementation idea: using "version aliases" (does not exist yet: #3285), so the latest version would always be at /docs/latest, and we could use a constant facet instead:

      searchParameters: {
        facetFilters: [`version:latest`],
      },

So when we publish a new version, search will temporarily be a bit stale, but won't break.


In the meantime, @s-pace @francoischalifour do you know if it's possible to add the "docsearch:version header multiple times?

If yes we could also do this on pages of the latest version:

<meta name="docsearch:version" content="2.0.0-alpha.62" />
<meta name="docsearch:version" content="latest" />
@slorber slorber added the bug An error in the Docusaurus core causing instability or issues with its execution label Sep 2, 2020
@s-pace
Copy link

s-pace commented Sep 2, 2020

If you want to add several values for a specific meta tag, you will need to follow this template:

<meta name="docsearch:version" content='["2.0.0-alpha.62","latest"]' />

Please note the use of single quote and double quote. The value of the content attribute must be a valid JSON.

slorber added a commit that referenced this issue Sep 2, 2020
…arch/Algolia, so that on new version publish, search still works even if new version is not already indexed (#3391)
@slorber
Copy link
Collaborator Author

slorber commented Sep 2, 2020

Thanks @s-pace , giving it a try here: #3393

Can we sync on Discord? Once I merge it, we should trigger docusaurus site reindexation otherwise site search would be broken.

Also not sure if this is what you want?

image

@s-pace
Copy link

s-pace commented Sep 2, 2020

Followed up on Discord. We need simple quote here.

slorber added a commit that referenced this issue Sep 3, 2020
* We should create an alias for searching last version of docs on DocSearch/Algolia, so that on new version publish, search still works even if new version is not already indexed (#3391)

* commit missing snapshot

* update after algolia changes

* put back facetFilters: [`version:${versions[0]}`] until latest facet is indexed
@slorber
Copy link
Collaborator Author

slorber commented Sep 3, 2020

So, it seems it worked, search is not broken just after the alpha 63 release :)

Next will be contextual search: #3396

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants