@coveo/ui-kit-sample-atomic-search-vite
v3.61.1
Published
Readme
Atomic Search Sample (vanilla + Vite)
Scaffold template:
atomic-search-viteA search interface built with@coveo/atomicweb components in plain HTML/JS, bundled with Vite. It runs against the publicsearchuisamplesorganization (theBarcaKnowledgeknowledge base) with no configuration required.
It shows how little code is needed to stand up a full Atomic search page: the
experience is declared as markup in index.html, and a small entry script
registers the components and points them at the sample organization.
What it shows
- A search box with query suggestions and instant results
- The same facets as the Headless search samples, managed by an
atomic-facet-manager: a hierarchical Category facet (ec_category) plus Article type, Robot series, Difficulty, and Author - A breadbox, query summary, and a sort dropdown (Relevance / Newest / Oldest)
- A result list with a basic result template (
atomic-result-link, excerpt) - Numbered pagination
Technology stack
- @coveo/atomic: Coveo's web-component library
- @coveo/headless: provides the sample engine configuration
- Vite: dev server and build
- Playwright: end-to-end tests
Getting started
pnpm install
pnpm dev # start the dev server (opens the browser)
pnpm build # production build
pnpm preview # preview the production build (http://localhost:4173)
pnpm e2e # end-to-end tests (Playwright)How it works
index.htmldeclares the experience with Atomic layout + components.src/main.jscallsdefineCustomElements()(from@coveo/atomic/loader), imports the Coveo theme, then builds a Headless search engine withgetSampleSearchEngineConfiguration()scoped to theBarcaKnowledgesearch hub (viasearch.searchHub) and hands it to the interface withinitializeWithSearchEngine(engine)before running the first search.vite.config.jscopies Atomic's runtimelang/andassets/folders out of the installed package intopublic/, because Atomic fetches them from/langand/assetsat runtime.
Using this sample as an MRE
This sample doubles as a minimal reproducible example for troubleshooting.
- Where to change the configuration:
src/main.js. It usesgetSampleSearchEngineConfiguration()(public sample credentials). To reproduce your own issue, replace it with yourorganizationId,accessToken, and (if needed) asearch.searchHub/pipeline. - Safe to modify:
src/main.js(configuration) and the Atomic markup inindex.htmlto reproduce a specific UI scenario. - Scaffolding you can usually ignore:
vite.config.js,playwright.config.ts, ande2e/. - Credentials: the sample configuration targets the public
searchuisamplesorganization, safe to share with customers or partners. It is not internal credentials.
Reproducing against a specific version
To reproduce an issue against a specific Coveo UI Kit version, install it after scaffolding:
npm install @coveo/atomic@<version>