Skip to content

Route search by framework and version named in the query#392

Merged
eugenia-scandit merged 3 commits into
mainfrom
route-search-by-typed-framework-and-version
Jul 17, 2026
Merged

Route search by framework and version named in the query#392
eugenia-scandit merged 3 commits into
mainfrom
route-search-by-typed-framework-and-version

Conversation

@eugenia-scandit

Copy link
Copy Markdown
Collaborator

Search results are filtered to the framework/version of the page the user is on. When the user names one explicitly in the query, that should win - so "barcode capture ios" from a web page returns iOS results.

  • Framework: a framework typed in the query (ios, android, flutter, web, react native, capacitor, cordova, titanium, .net ios/android) overrides the page framework; two named frameworks return both. Nothing typed keeps the page framework. On a framework-less page (home, /hosted/, concept pages) guides fall back to the most-used framework (web) rather than every framework's guide, while framework-agnostic pages (/hosted/, /id-documents/) stay findable.

  • Version: a version named in the query (version 6, v6, 6.x, 6.28, sdk 6) rewrites the contextual docusaurus_tag filter to the newest tag on that major line - 6 to docs-default-6.28.11, 7 to docs-default-7.6.14, 8 to current.

The typed framework word is left in the query; removeWordsIfNoResults drops it when it does not match page text, so ranking is unaffected.

Search results are filtered to the framework/version of the page the user
is on. When the user names one explicitly in the query, that should win -
so "barcode capture ios" from a web page returns iOS results.

- Framework (client-side, transformItems): a framework typed in the query
  (ios, android, flutter, web, react native, capacitor, cordova, titanium,
  .net ios/android) overrides the page framework; two named frameworks
  return both. Nothing typed keeps the page framework. On a framework-less
  page (home, /hosted/, concept pages) guides fall back to the most-used
  framework (web) rather than every framework's guide, while framework-
  agnostic pages (/hosted/, /id-documents/) stay findable.

- Version (backend, search interceptor): a version named in the query
  (version 6, v6, 6.x, 6.28, sdk 6) rewrites the contextual docusaurus_tag
  filter to the newest tag on that major line - 6 to docs-default-6.28.11,
  7 to docs-default-7.6.14, 8 to current.

The typed framework word is left in the query; removeWordsIfNoResults drops
it when it does not match page text, so ranking is unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread src/theme/SearchBar/index.js Outdated
Addresses review feedback: the search widget's "major version typed in a
query -> docusaurus_tag" map previously hardcoded patch versions (6.28.11,
7.6.14) and the current mapping, which could drift from the real versions.

Now docusaurus.config.ts holds a single docsVersions source of truth (the
preset consumes it directly), and buildVersionTagByMajor derives the map
from it - each frozen version -> docs-default-<version>, current ->
docs-default-current with its major from label. The result is exposed via
customFields.versionTagByMajor and read in SearchBar, so a version bump
through scripts/update-version.py flows in automatically with nothing to
keep in sync.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@eugenia-scandit
eugenia-scandit force-pushed the route-search-by-typed-framework-and-version branch from 51e606d to 4ac7c0c Compare July 17, 2026 08:57

@lucatorella lucatorella left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Automated code review (Claude Code, high effort). 6 findings below — 5 inline, plus one that anchors to unchanged code outside this diff's hunks so it's noted here instead:

[correctness, CONFIRMED] ResultsFooter's fallback note can contradict the actual results shown (src/theme/SearchBar/index.js, ResultsFooter / showApiFallbackNote, around line 85 on main).

On a framework-less page, currentFramework is "". A user searches "barcode capture ios"; transformItems filters API hits to iOS (via apiFwTargets = queriedFrameworks), but showApiFallbackNote = !currentFramework && hasApiResults is still true, so the footer renders "Showing the web API reference - open a specific SDK's docs for another platform" even though the results shown are iOS, not web.

Overall theme of the inline findings: the new version/framework query-inference logic false-positives on ordinary query text and silently narrows or rewrites the search facets, in several cases contradicting comments in the same file promising broader/framework-agnostic results.

Comment thread src/theme/SearchBar/index.js
Comment thread src/theme/SearchBar/index.js Outdated
Comment thread src/theme/SearchBar/index.js Outdated
Comment thread src/theme/SearchBar/index.js Outdated
Comment thread src/theme/SearchBar/index.js Outdated
Addresses code-review findings on the query-inference logic:

- Footer note: only show the "web API reference" fallback note when no
  framework was typed (compute hasQueriedFramework from state.query), so it
  can't contradict framework-filtered results.
- Version tag rewrite: swap only the versioned docs tag (docusaurus_tag:docs-*),
  leaving docusaurus_tag:default and the contextual OR intact so
  non-versioned / framework-agnostic pages still match when a version is typed.
- Version detection: drop the bare dotted-number pattern; only an explicit
  marker (version/ver/v/sdk N) triggers a rewrite, avoiding false positives on
  incidental tokens like "6.5" or "7.1".
- Framework-agnostic pages (/hosted/, /id-documents/, concept pages) stay
  findable in every branch - typed framework, page framework, and
  framework-less - instead of being dropped; only /sdks/ guides are narrowed.
- "web" query token requires stronger context (web sdk, on/for/in/using web)
  so ordinary queries ("web view", "web socket") don't hijack routing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@eugenia-scandit
eugenia-scandit force-pushed the route-search-by-typed-framework-and-version branch from d8b7c40 to aca6b32 Compare July 17, 2026 09:55
@eugenia-scandit

Copy link
Copy Markdown
Collaborator Author

Pushed aca6b32. Updated per the review:

  • footer note only shows when no framework is typed
  • version rewrite swaps only docusaurus_tag:docs-*, leaving docusaurus_tag:default and the OR intact
  • only explicit version/v/sdk N triggers a version rewrite
  • framework-agnostic pages (/hosted/, /id-documents/) stay findable in every branch now, not just the typed-framework one
  • kept the web token but gated it behind stronger context (web sdk, on/for/in/using web) so "web view"/"web socket" don't hijack routing

@lucatorella lucatorella left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving after review — inline findings addressed in commit aca6b32 ("Harden query-based framework/version routing from review feedback").

@eugenia-scandit
eugenia-scandit merged commit 8acdd4e into main Jul 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants