Skip to main content

Search

@archibald/commerce/search implements the @archibald/search contract against the SAP Commerce search OCC API: product search, suggestions, facets and pagination. It is the built-in alternative to an external engine like Coveo behind the same SearchClient.

How to use

Client

// src/{platform}/client/api/creators/search.ts
import { SearchClient } from '@archibald/search';
import { CommerceSearchAdapter } from '@archibald/commerce/search';

import { api } from 'shop/client/api';

export default new SearchClient({ adapter: CommerceSearchAdapter, api });

Server

// src/{platform}/server/module/server.tsx
import { SearchModule } from '@archibald/search';
import { CommerceSearchProvider } from '@archibald/commerce/search';

new SearchModule({
provider: new CommerceSearchProvider({
config: () => this.configService.get('hybris.api'),
mappers: [ProjectCommerceProductMapper]
})
});

Search results are products, so the provider takes the same mapper extension as the product domain — one ProjectCommerceProductMapper covers both.

API reference

ExportSideWhat it is
CommerceSearchAdapterclientSearchClient adapter shaping search/suggestion calls
CommerceSearchQuery, CommercePagination, CommerceFacet, CommerceFacetBreadcrumb, CommerceSort, CommerceFacetSchemaclientTyped OCC search shapes for result pages, facet UIs and sorting
CommerceSearchProviderserverSearchModule provider querying OCC v2 search
CommerceSearchMapper, mapping helpersserverOCC search response → storefront mapping; extend for custom facets/fields

Configuration

Reads hybris.api from the environment config through the provider's config callback.

Further documentation

  • Search guide — the provider/adapter architecture, hooks, event tracking.
  • Coveo integration — swapping this domain for an external search engine.