Visitar URL original
docs: add localized global search by timothyokooboh · Pull Request #11097 · axios/axios · GitHub
Skip to content

docs: add localized global search - #11097

Merged
jasonsaayman merged 5 commits into
axios:v1.xfrom
timothyokooboh:feat/add-global-search-to-docs
Aug 4, 2026
Merged

jasonsaayman merged 5 commits into
axios:v1.xfrom
timothyokooboh:feat/add-global-search-to-docs

Conversation

@timothyokooboh

@timothyokooboh timothyokooboh commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds localized, private, in-browser global search to the documentation using VitePress’s built-in MiniSearch integration.

Linked issue

N/A

Changes

  • Enable local search for English, Chinese, Spanish, and French.
  • Search only the active locale and exclude home/sponsor pages.
  • Preserve native VitePress styling, keyboard controls, query persistence, and detailed-view toggle.
  • Chinese, Spanish, and French copy is ready for native-speaker review.

Checklist

  • Tests added or updated (N/A, only docs configuration; production build passes)
  • Docs/types updated if public API changed (N/A, no public API change)
  • No breaking changes
Screenshot 2026-07-25 at 8 48 47 PM Screenshot 2026-07-25 at 8 48 36 PM

Summary by cubic

Adds localized, private, in‑browser global search to the docs using vitepress local search, with better Chinese query relevance via a custom tokenizer. It searches only the active locale and excludes home and sponsor pages.

Description

  • Summary of changes
    • Added docs/.vitepress/search.mts and wired it via themeConfig.search in config.mts.
    • Implemented docs/.vitepress/tokenizeSearchText.js: keep default non‑Han behavior; index Han unigrams; use overlapping bigrams for multi‑character queries.
    • Enabled local search for English, Chinese, Spanish, and French with localized UI strings.
    • Set search: false on home and sponsor pages in all locales.
    • Updated PRE_RELEASE_CHANGELOG.md under Documentation.
  • Reasoning
    • Keep search fast and private (no external requests).
    • Improve Chinese query relevance and limit results to the active locale.
  • Additional context
    • zh/es/fr translations need native review.
    • Preserves default styling, keyboard shortcuts, detailed view toggle, and query persistence.

Docs

Suggest adding to /docs/ contributor guidelines:

  • Use search: false in frontmatter to exclude pages.
  • Update docs/.vitepress/search.mts when adding a locale.
  • Avoid changing tokenizeSearchText unless adjusting Chinese tokenization.

Testing

  • Added docs/.vitepress/tokenizeSearchText.test.js.
    • Confirms non‑Han tokenization unchanged.
    • Ensures Han indexing uses unigrams; queries use bigrams; tokens exist in zh content.
  • Updated docs/package.json to run test:search before vitepress build.
  • Manual checks: locale‑scoped results; home/sponsor pages excluded; keyboard shortcuts and detailed view toggle work.

Semantic version impact

Patch: docs‑only change; no runtime or public API impact.

Written for commit a9df859. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 11 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Greptile Summary

Adds localized in-browser documentation search for English, Chinese, Spanish, and French, with Han-aware tokenization for Chinese text. The built documentation site was exercised in all four locales: search opened with localized controls, returned matching results, and a Chinese multi-character query navigated to the expected Chinese documentation page. No defects were found.

Confidence Score: 5/5

T-Rex T-Rex Logs

What T-Rex did

  • Built the VitePress documentation with npm run docs:build and confirmed four passing search-tokenizer tests.
  • Served the built site and ran a Playwright browser harness across English, Chinese, Spanish, and French search entry points.
  • Verified localized search labels and controls across locales, and confirmed that querying 请求配置 on /zh/ returned a match and navigated to /zh/pages/advanced/request-config.html#socketpath.
  • Validated that the local search opens, localizes, and returns results, contradicting a prior claim of failure.

T-Rex Ran code and verified through T-Rex

Reviews (4): Last reviewed commit: "Merge branch 'v1.x' into feat/add-global..." | Re-trigger Greptile

@jasonsaayman jasonsaayman added the commit::docs The PR is related to docs label Jul 29, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 4 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread docs/.vitepress/tokenizeSearchText.js
Comment thread docs/.vitepress/search.mts
@jasonsaayman
jasonsaayman merged commit f64e458 into axios:v1.x Aug 4, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit::docs The PR is related to docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants