Skip to content

Algolia search broken after new release #3391

Closed

Description

@slorber

🐛 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" />

Activity

  1. added
    bug
    on Sep 2, 2020
  2. s-pace commented on Sep 2, 2020

    @s-pace

    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.

  3. slorber commented on Sep 2, 2020

    @slorber
    CollaboratorAuthor

    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

  4. s-pace commented on Sep 2, 2020

    @s-pace

    Followed up on Discord. We need simple quote here.

  5. slorber commented on Sep 3, 2020

    @slorber
    CollaboratorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions