Skip to content

EDU-18458 - [HC] Remove KI category from search results page#85

Open
barbara-celi wants to merge 24 commits into
mainfrom
EDU-18458-ki-search
Open

EDU-18458 - [HC] Remove KI category from search results page#85
barbara-celi wants to merge 24 commits into
mainfrom
EDU-18458-ki-search

Conversation

@barbara-celi

@barbara-celi barbara-celi commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

EDU-18458

This PR adds support for excluding specific documentation sections from the Help Center search page while keeping them visible in the main sidebar.

It introduces a reusable excludeFromSearch flag on the Section type. Consumers (e.g. Help Center) can mark a section with this flag to:

  • Hide it from the search filter tabs and the left section/counts list.
  • Exclude its doctype from search page results (Algolia and Hybrid Search) and the search page "All results" count (nbHits).

Note: The header SearchInput dropdown is not affected by this PR; exclusions apply to the full /search page only.
This was implemented to move Known Issues out of the search filters and into the sidebar (between Announcements and Status) without hardcoding doctype IDs in the shared components package.

Related work

EDU-17906 — Hybrid Search integration

This branch builds on feat/hybrid-search, which adds a hybrid search client in search-config.ts and related utilities. The EDU-18458 exclusion logic extends the client to parse NOT doctype:"..." filters and apply doctype exclusions client-side (the upstream Hybrid Search API does not natively support doctype filtering).

Without the hybrid search foundation, exclusion would only apply on the Algolia code path via InstantSearch Configure.filters.

Changes

1. New excludeFromSearch flag on Section

  • Added optional excludeFromSearch?: boolean to Section in src/utils/typings/types.ts
  • Follows the same pattern as isExternalLink, but for internal sections that should remain in the sidebar and be excluded from search

2. Search filter UI

  • search-filter-tab-bar: Skips sections where excludeFromSearch is true.
  • search-sections: Extends the existing external-link filter to also skip excludeFromSearch sections.

3. Search query and result counts

  • search-results: Builds an Algolia and Hybrid Search filter that excludes all flagged doctypes, e.g. NOT doctype:"known-issues"
  • This removes excluded sections from the result list and the "All results" count (nbHits).
  • infiniteHits: Updates doctype-selection detection so the always-present NOT doctype:"..." clauses do not break facet count updates when no category tab is selected.

Design notes

  • Data-driven: Exclusion is configured in the consumer via LibraryContextProvider sections data, not hardcoded in components
  • Reusable: Any section can opt out of search by setting excludeFromSearch: true.
  • Sidebar unchanged: Excluded sections still appear in the main sidebar; only search UI and search results are affected
  • Complements isExternalLink: isExternalLink hides external links from search sections; excludeFromSearch hides internal sections from search entirely.

Consumer change required

This PR only updates @vtexdocs/components. For the implementation in the Help Center, see the vtexdocs/helpcenter#476

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Requires change to documentation, which has been updated accordingly.

barbara-celi and others added 20 commits May 5, 2026 13:02
This commit introduces a new hybrid search adapter for the `@vtexdocs/components` package, allowing integration with the Help Center's API while maintaining backward compatibility with Algolia. Key changes include the addition of a new `HybridSearchConfig` interface, updates to the `search-config.ts` file to support hybrid search, and modifications to the `SearchConfig` function to handle both Algolia and hybrid configurations. The implementation aims for minimal code changes and reuses existing components.
This update modifies the request selection logic in the `search-config.ts` file to prioritize requests with a non-empty query. If no such request is found, it defaults to the first request in the array. This change enhances the hybrid search functionality by ensuring more relevant queries are processed.
…tion

This commit introduces a new utility function, `stripMarkdownForSnippet`, to remove Markdown syntax from text snippets, enhancing the readability of search results. Additionally, the `hitsPerPage` configuration is now dynamically set from the search configuration, improving pagination handling in the search results component.
- Enhanced stripMarkdownForSnippet to handle images, code blocks, blockquotes
- Fixed regex patterns for better markdown syntax removal
- Ensures search results display clean plain text without markdown formatting

Co-authored-by: Cursor <[email protected]>
- Add special handling for tracks URLs to use only last segment
- Fix URL pattern: /pt/docs/tracks/modulos-da-vtex-i instead of full path
- Improve snippet handling to remove mid-word truncation
- Strip incomplete words at start of truncated snippets

Co-authored-by: Cursor <[email protected]>
- Added special handling for tutorial URLs to use only the last segment
- Improved URL pattern for special doctypes (faq, known-issues, troubleshooting, announcements) to return only the slug
- Updated comments for clarity on URL construction logic
- Updated URL construction logic to handle multiple special document types (tracks, tutorials, faq, known-issues, troubleshooting, announcements) using a unified approach.
- Simplified the URL pattern to return only the slug for these document types.
- Removed redundant conditions and improved code clarity with updated comments.
- Updated URL construction logic to differentiate between document types (tracks, tutorials, faq, known-issues, troubleshooting, announcements).
- Implemented specific handling for tracks and tutorials to retain "docs" in the URL, while removing it for other types.
- Enhanced comments for clarity on the URL patterns and their respective handling.
…ration

- Added specific handling for 'faq', 'troubleshooting', 'announcements', and 'known-issues' document types to return only the slug in the URL.
- Enhanced comments to clarify the URL patterns and their handling logic.
- Ensured consistent URL construction for localized paths.
# Conflicts:
#	dist/index.css.map
#	dist/index.mjs.map
…electors

Adds data-testid, data-filter, and data-active attributes to
SearchFilterTab and SearchFilterTabBar so Cypress tests in
vtexdocs/helpcenter can select the tab bar, individual tabs,
and count badges without fragile DOM traversal.
@barbara-celi barbara-celi self-assigned this Jun 18, 2026
@barbara-celi barbara-celi added enhancement New feature or request release-patch Patch version bump labels Jun 18, 2026
@barbara-celi barbara-celi added release-auto Automatic version bump and removed release-patch Patch version bump labels Jun 18, 2026
@barbara-celi barbara-celi force-pushed the EDU-18458-ki-search branch from 108c41c to cf3deb7 Compare June 18, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request release-auto Automatic version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants