Configuration

SDK Reference

Complete reference for every configuration option you can pass to the SearchX widget.


Initialization

The widget is initialized by calling SearchXSDK.init() once on your page with a configuration object:

SearchXSDK.init({
  app_id: 'YOUR_APP_ID',
  api_key: 'YOUR_API_KEY',
  components: {
    SearchBar: { root: 'search-bar' },
    SearchPage: { root: 'search-page' },
  },
  settings: {
    /* feature toggles + UI options — see sections below */
  },
});

Every option except the credentials and components is optional. Leave a setting out to keep the SDK default.


Top-level parameters

ParameterTypeRequiredDescription
app_idstringYesYour Application ID, available from the Applications page in the SearchX dashboard.
api_keystringYesThe public API key for this application, available from the Keys tab in the SearchX dashboard.
componentsobjectYesDOM containers the widget mounts into. See the Components object section below.
apiPageURLstringNoBase URL for the SearchX API. Defaults to the production endpoint and only needs to be set if you're targeting a non-production environment.
customCSSUrlstringNoURL to a custom CSS file that overrides the default widget styles. See Widget Styling.
customLocaleUrlstringNoURL template for translation files. Use {{lng}} as a placeholder for the language code (e.g. /locales/{{lng}}.json).
defaultLanguagestringNoInitial language code (e.g. en, el). When omitted the widget auto-detects from the visitor's browser.
settingsobjectNoNested object with the per-feature toggles documented in the sections below.

Components object

The components object tells the widget where to render. Both keys are optional independently — render only the search bar, only the results page, or both.

components: {
  SearchBar: { root: 'search-bar' },
  SearchPage: { root: 'search-page' },
}
PropertyDescription
SearchBar.root or SearchBar.roots[]DOM element ID where the search bar mounts. Use roots: ['id-1', 'id-2'] when the same bar appears in more than one place on the page (e.g. desktop header + mobile drawer).
SearchPage.root or SearchPage.roots[]DOM element ID where the search results page mounts. Same roots[] pattern available.

The target elements must exist in the DOM before init() runs and must be empty.


Settings — Layout & behaviour

High-level controls for where the widget routes searches, the platform integration mode it should use, and how pagination behaves.

SettingTypeDefaultDescription
searchPageURLstringURL the search bar navigates to when the shopper submits a query. Use {query} as a placeholder for the typed text — e.g. /search?q={query}.
mobileViewPortstring | number"900px"Breakpoint at which the widget switches to its mobile layout.
platform"opencart" | "custom" | "other""opencart"Controls how the widget delivers Add to Cart / Add to Wishlist actions. "opencart" triggers the built-in OpenCart cart integration. "custom" / "other" dispatch DOM events your storefront can listen to (see Event Handling).
compactPaginationbooleanfalseRenders the compact pagination control beneath search results.
defaultProductsPerPage12 | 24 | 36 | 4824Initial number of products shown per page in the search results grid. Shoppers can still change the per-page value from the toolbar.
defaultPlaceholderstringCustom placeholder text for the empty search input.
topSearchesstring[]Manual list of popular search terms shown as suggestions in the search bar popup. Usually managed from the SearchX dashboard instead — the widget fetches that list automatically at runtime.

Settings — Search bar popup

Controls the small popup that opens beneath the search bar while the shopper is typing — top searches, recent searches, featured products, and promotional links.

SettingTypeDefaultDescription
showPopupAddToCartbooleanfalseShow a quick Add to Cart action next to each product result inside the search bar popup.
showPopupSearchIconbooleantrueShow the small magnifier glyph next to each Recent search and Top search suggestion in the popup. Set to false for a cleaner text-only list.
suggestedLinksSuggestedLink[]  or  Record<string, SuggestedLink[]>Promotional links rendered as chips inside the search bar popup. Normally managed from the SearchX dashboard (Suggested Links), but can also be passed inline for previews. Two shapes accepted — a flat array, or a per-locale map (e.g. { en: [...], el: [...] }) when you want different titles per language.

Settings — Product cards

What metadata each product card displays in the search results grid, and which shopper actions are surfaced on the card.

SettingTypeDefaultDescription
showBrandbooleanfalseShow the brand name on product cards.
showSizesbooleanfalseShow available sizes on product cards.
showColorbooleanfalseShow the product colour on product cards.
showDescriptionbooleanfalseShow the product description on product cards.
showSalePricebooleanfalseShow the sale price with the original price struck through. Requires a sale_price on your products.
showAddToCartButtonbooleantrueShow the Add to Cart button on each product card in the search results grid.
wishlistEnabledbooleanfalseShow the Add to Wishlist heart icon on product cards.
cartButtonTextstringCustom label for the Add to Cart button. Leave blank to use the default translation.
wishlistButtonTextstringCustom label for the Add to Wishlist button. Leave blank to use the default translation.

Settings — Filter sidebar

Which facet panels appear in the filter sidebar of the search results page. Each toggle is independent — turn on only the panels that match your catalogue.

SettingTypeDefaultDescription
showBrandFacetbooleantrueShow the Brand facet in the filter sidebar.
showCategoryFacetbooleanfalseShow the Categories facet in the filter sidebar.
showPriceRangeFilterbooleantrueShow the price range filter (slider + min/max inputs).
showOnSaleFacetbooleanfalseShow the On Sale toggle. Filters results to products that have a positive sale price below the regular price. Opt-in — requires a sale_price on your indexed products.
showSizeFilterbooleanfalseShow the Size facet in the filter sidebar.
showColorFilterbooleanfalseShow the Colour facet in the filter sidebar.

AI-assisted search is configured from the SearchX dashboard. The widget-side toggle below lets you opt the widget in or out at runtime.

SettingTypeDefaultDescription
aiSearchEnabledbooleanfalseEnable the AI Search experience inside the widget.
aiSearchChipsstring[]  or  Record<string, string[]>Prompt chips shown in the AI Search panel. Same per-locale shape as suggestedLinks — flat array, or { en: [...], el: [...] }. Normally managed from the SearchX dashboard.

Deprecated settings (still supported)

These settings continue to work for backward compatibility, but new integrations should use the explicit replacements below. The widget treats the new key as authoritative whenever both are set.

DeprecatedReplacementNotes
showIconshowPopupAddToCartRenamed for clarity — it controls the popup's quick Add to Cart action, not a generic icon.
showBothFacetsshowBrandFacet + showCategoryFacetUse the two explicit toggles to show either, both, or neither facet.
showCategoryshowCategoryFacetRenamed to match the rest of the explicit facet toggles.
primaryFacetAttributeshowBrandFacet + showCategoryFacetThe two explicit toggles cover every combination the old setting supported.

Full example

A complete init() call with every section represented. Trim to the settings your storefront actually needs — leaving the rest out keeps you on safe defaults.

SearchXSDK.init({
  app_id: 'YOUR_APP_ID',
  api_key: 'YOUR_API_KEY',
  apiPageURL: 'https://admin.searchxengine.ai/api/v1',
  components: {
    SearchBar: { root: 'search-bar' },
    SearchPage: { root: 'search-page' },
  },
  customCSSUrl: '/assets/theme.css',
  customLocaleUrl: '/assets/i18n/{{lng}}.json',
  defaultLanguage: 'en',
  settings: {
    // Layout & behaviour
    searchPageURL: '/search?q={query}',
    mobileViewPort: '900px',
    platform: 'custom',
    compactPagination: true,
    defaultProductsPerPage: 24,
    defaultPlaceholder: 'Search for products...',

    // Search bar popup
    showPopupAddToCart: true,
    showPopupSearchIcon: true,

    // Product cards
    showBrand: true,
    showSizes: true,
    showColor: true,
    showDescription: false,
    showSalePrice: false,
    showAddToCartButton: true,
    wishlistEnabled: true,
    cartButtonText: 'Buy Now',
    wishlistButtonText: 'Save for later',

    // Filter sidebar
    showBrandFacet: true,
    showCategoryFacet: true,
    showPriceRangeFilter: true,
    showOnSaleFacet: false, // opt-in; requires sale_price on indexed products
    showSizeFilter: true,
    showColorFilter: true,

    // AI search
    aiSearchEnabled: false,
  },
});

Previous
Skroutz Feed