Skip to content

feat(samples): point headless-search-react at BarcaKnowledge with knowledge-base facets#7897

Open
alexprudhomme wants to merge 14 commits into
mainfrom
KIT-5685-headless-search-react
Open

feat(samples): point headless-search-react at BarcaKnowledge with knowledge-base facets#7897
alexprudhomme wants to merge 14 commits into
mainfrom
KIT-5685-headless-search-react

Conversation

@alexprudhomme

@alexprudhomme alexprudhomme commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

KIT-5685

Problem

The headless-search-react sample was wired to the generic sample search hub, demoed facets on generic fields, and had grown into a large multi-page demo (with SSR server code and many legacy feature pages). We want a small, copy-friendly scaffold that targets the BarcaKnowledge knowledge base.

Solution

  • Point the sample's SearchEngine at searchHub = 'BarcaKnowledge'. This is done in a new src/engine.ts (buildEngine()) built on getSampleSearchEngineConfiguration() — there is no separate engine-configuration.ts module, and the SSR/server code was removed as part of the consolidation.
  • Consolidate the multi-page/demo-heavy React Router sample into a single minimal UI (search box, facets, results, pager) with a shared useController hook for Headless controller subscriptions.
  • Repoint the facets to knowledge-base fields: ec_category (hierarchical), article_type, robot_series, difficulty_level, plus author and date.
  • Track result clicks: a ResultLink component uses buildInteractiveResult so opening a result logs a click analytics event (feeds query suggestions). Result hrefs go through a filterProtocol allowlist and open with rel="noopener noreferrer".
  • Accessibility: the current pager button uses aria-current="page" (omitted otherwise).

Tested

  • pnpm build passes; vitest 1/1 passes; oxlint/oxfmt clean.
  • App loads with 0 console errors; live POST /rest/search returns 200 with searchHub=BarcaKnowledge and the new facets.

Notes

  • For facet values to render, the org must have BarcaKnowledge content indexed with these fields enabled as facets (platform-side dependency).

@changeset-bot

changeset-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d563ded

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@svcsnykcoveo

svcsnykcoveo commented Jun 29, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@pkg-pr-new

pkg-pr-new Bot commented Jun 29, 2026

Copy link
Copy Markdown
@coveo/atomic

npm i https://pkg.pr.new/@coveo/atomic@7897

@coveo/atomic-hosted-page

npm i https://pkg.pr.new/@coveo/atomic-hosted-page@7897

@coveo/atomic-legacy

npm i https://pkg.pr.new/@coveo/atomic-legacy@7897

@coveo/atomic-react

npm i https://pkg.pr.new/@coveo/atomic-react@7897

@coveo/auth

npm i https://pkg.pr.new/@coveo/auth@7897

@coveo/bueno

npm i https://pkg.pr.new/@coveo/bueno@7897

@coveo/create-atomic

npm i https://pkg.pr.new/@coveo/create-atomic@7897

@coveo/create-atomic-component

npm i https://pkg.pr.new/@coveo/create-atomic-component@7897

@coveo/create-atomic-component-project

npm i https://pkg.pr.new/@coveo/create-atomic-component-project@7897

@coveo/create-atomic-result-component

npm i https://pkg.pr.new/@coveo/create-atomic-result-component@7897

@coveo/create-atomic-rollup-plugin

npm i https://pkg.pr.new/@coveo/create-atomic-rollup-plugin@7897

@coveo/headless

npm i https://pkg.pr.new/@coveo/headless@7897

@coveo/headless-react

npm i https://pkg.pr.new/@coveo/headless-react@7897

@coveo/shopify

npm i https://pkg.pr.new/@coveo/shopify@7897

commit: 48683dd

…wledge-base facets

Set the search hub to BarcaKnowledge via a shared engine configuration and replace the generic sample facets with knowledge-base fields (ec_category, article_type, robot_series, difficulty_level).
Add a global stylesheet using the Coveo brand colors (coral, blue, yellow, mint) as plain solid accents, render sections as cards, restyle the header/nav, and use the official Coveo horizontal logo.
Search box on top, facets in a left sidebar, results in the main column, pager below, and advanced component demos in a collapsible section.
…ample

Replace the kitchen-sink reference with a focused, idiomatic search UI mirroring the search-vite sample: a single useController hook plus small per-controller components (search box, facets, sort, results, pager), pointed at the BarcaKnowledge search hub. Drop SSR, routing, SAML/auth, and the class+function component duplication.
…eact

Add a CategoryFacet component bound to the ec_category field (pipe-delimited hierarchy) with drill-down and breadcrumb, alongside the existing article type, robot series, difficulty, and author facets.
Add a DateFacet (Past week/month/quarter/year) bound to the date field, labeling each range by parsing the relative-date unit, and give each facet a bordered outline.
Format the README with oxfmt, drop the unused searchHub export, and remove the stale knip entry/ignore patterns (server/server.tsx, src/pages/AtomicReactPage.css) left over from the minimal rewrite.
The unused searchHub export (fixed in engine.ts) was the only knip error; the stale entry/ignore patterns are non-fatal config hints. Reverting the knip.js edit keeps this PR scoped to search-react and avoids marking all projects affected (which pulled in an unrelated, failing SSR-NextJS e2e).
Add a ResultLink component using buildInteractiveResult so opening a result logs a click analytics event, restoring the result tracking that powers query suggestions.
- Reintroduce filterProtocol URI allowlist for result links and add rel=noopener noreferrer (guards against javascript: hrefs)
- Use aria-current="page" for the current pager button and omit it otherwise
Align the package name with samples/CONTRIBUTING.md (@coveo/ui-kit-sample-<name>); stays private until published.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants