Search right language in search bar
See original GitHub issueIt seems that reasonml website search bar doesn’t search the correct language. It only search english documentation when I’m actually on Espanol
I saw @chenglou restricting the doc search to ‘english’ only based on https://github.com/algolia/docsearch-configs/pull/292 because searching ‘foo’ gives 5+ result across all languages. Till today https://github.com/algolia/docsearch-configs/blob/master/configs/reason.json is still restricted to english
Some suggestion. You can search the right language by reverting that commit and change this https://github.com/reasonml/reasonml.github.io/blob/95f4d390b50f823a7b88f21098fec30bc34c6162/website/siteConfig.js#L265-L268
to
algolia: {
apiKey: "966d1e412f67114a07dc0afe44b19b53",
indexName: "reason",
algoliaOptions: {
facetFilters: ["lang:LANGUAGE"]
}
},
P.S : I can help to submit a PR if you want
This is because LANGUAGE
will be replaced by Docusaurus to the right language.
Source code:
https://github.com/facebook/Docusaurus/blob/d28b864a59fabeea45add8c090a13de7d0530de5/lib/core/Site.js#L128-L142
algoliaOptions: ${JSON.stringify(
this.props.config.algolia.algoliaOptions
)
.replace('VERSION', docsVersion)
.replace('LANGUAGE', this.props.language)}
Example on my site: Only search for ‘korean’ documentation when on ‘korean’
Only search for ‘chinese’ documentation when on ‘chinese’
cc @joelmarcey @yangshun . Maybe we should update Docusaurus documentation on search bar. I don’t think user know this extra processing that we did. We only refer them to https://community.algolia.com/docsearch/documentation/ 😢 based on https://docusaurus.io/docs/en/search.html#enabling-the-search-bar
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
@endiliey so this’ll work today if you make the change right? Feel free to submit a PR to change it for reasonml here!
@endiliey I would be fine putting those back. We can file an issue as a
good first issue
or a PR can be done.