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 bug unable to search docs according to its version #797

Merged
merged 1 commit into from
Jun 23, 2018

Conversation

endiliey
Copy link
Contributor

@endiliey endiliey commented Jun 23, 2018

Motivation

As per https://docusaurus.io/docs/en/search#extra-search-options

Any occurrences of "VERSION" or "LANGUAGE" will be replaced by the version or language of the current page, respectively.

However, the current implementation is currently broken, while algolia docsearch expect something like '1.3.0', we provide 'current' as the version if we are currently in the latest stable version.

https://github.com/facebook/Docusaurus/blob/c5661b0e1e131803709852adc2283fb4894aabcc/lib/core/Site.js#L36-L43

https://github.com/facebook/Docusaurus/blob/c5661b0e1e131803709852adc2283fb4894aabcc/lib/core/Site.js#L130-L134

Docusaurus.io docsearch is working fine because we don't search according to current version.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Use this algolia index for testing and use version facetfilters

algolia: {
    apiKey: 'c53337307f1787a9199348cd8263f666',
    indexName: 'docusaurus_meta',
    algoliaOptions: {
      facetFilters: [ "language:LANGUAGE", "version:VERSION" ] 
    }
  },

Before (search is broken)
before

After this PR (search according to current version)
after

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jun 23, 2018
@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-preview ready!

Built with commit 105bd8e

https://deploy-preview-797--docusaurus-preview.netlify.com

Copy link
Contributor

@yangshun yangshun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@endiliey
Copy link
Contributor Author

endiliey commented Jun 23, 2018

It's quite a serious bug actually. It's just that not many user know that they can refine their algolia search 😢 because it's quite complicated (you have to learn algolia config 😂 )

Btw I'll merge this & sleep. I'll fix the other PR tmrw @yangshun

@JoelMarcey
Copy link
Contributor

@endiliey - With all the great fixes you and @yangshun have been putting out over the last couple of days, I think a 1.3.1 version is appropriate soon.

@endiliey endiliey deleted the docversion branch June 24, 2018 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants