[feature][search] Add env-gated Algolia DocSearch alongside local search#3955
Open
dataroaring wants to merge 1 commit into
Open
[feature][search] Add env-gated Algolia DocSearch alongside local search#3955dataroaring wants to merge 1 commit into
dataroaring wants to merge 1 commit into
Conversation
Enable Apache Doris docs to opt into Algolia DocSearch without removing the existing local search: - Add the Algolia Crawler domain-verification token to static/robots.txt. - Add a USE_ALGOLIA build flag. When set, load @docusaurus/theme-search-algolia alongside the local-search theme and inject themeConfig.algolia from ALGOLIA_APP_ID / ALGOLIA_SEARCH_API_KEY / ALGOLIA_INDEX_NAME env vars. - The local-search theme stays loaded so its @generated index module keeps compiling; the SearchBar swizzle now chooses Algolia vs local at runtime via customFields.useAlgolia. DocSearch runs modal-only (searchPagePath:false) so it doesn't collide with the local /search route. - Pin @docusaurus/theme-search-algolia as a direct dependency. Default behavior is unchanged: with USE_ALGOLIA unset the site builds and serves the existing local search exactly as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Enable Apache Doris docs to opt into Algolia DocSearch without removing the existing local search (
@yang1666204/docusaurus-search-local).Why
The Algolia Crawler needs a domain-verification token served from
robots.txt, and we want to A/B Algolia against the current local search before fully cutting over rather than swapping it out in one step.Changes
static/robots.txtdocusaurus.config.jsUSE_ALGOLIAbuild flag; conditionally load the Algolia theme +themeConfig.algolia(read from env); exposecustomFields.useAlgoliasrc/theme/SearchBar/index.jscustomFields.useAlgoliapackage.json@docusaurus/theme-search-algolia@3.6.3as a direct dependencyDesign notes
@generatedindex module (which theproxiedGeneratedswizzle depends on) keeps compiling.searchPagePath: false) so it doesn't collide with the local/searchroute.contextualSearch: truekeeps results scoped per version/locale.USE_ALGOLIAunset, the site builds and serves the existing local search exactly as before.How to enable
Testing
node --check; logically untouched.USE_ALGOLIA=truepath has not been built end-to-end here (requires live Algolia credentials). Import path/default export for the Algolia SearchBar were verified, but a realUSE_ALGOLIA=truebuild should be run before relying on it.🤖 Generated with Claude Code