Configuration

SDK Reference

Complete reference for all SearchX SDK configuration options.


Initialization

The SDK is initialized by calling SearchXSDK.init() with a configuration object:

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" },
  },
  settings: { ... },
});

Top-Level Parameters

ParameterTypeRequiredDescription
app_idstringYesYour unique Application ID
api_keystringYesYour public API key for search requests
apiPageURLstringNoBase URL for the SearchX API. Defaults to https://admin.searchxengine.ai/api/v1
componentsobjectYesMount points for SDK components
customCSSUrlstringNoURL to a custom CSS file loaded by the SDK
customLocaleUrlstringNoBase URL/path for translation JSON files
defaultLanguagestringNoInitial language code (e.g., en, el)
settingsobjectNoFeature and UI configuration (see below)

Components Object

The components object specifies where to mount SDK UI elements:

components: {
  SearchBar: { root: "search-bar-element-id" },
  SearchPage: { root: "search-page-element-id" },
}
PropertyDescription
SearchBar.rootDOM element ID where the search bar will be rendered
SearchPage.rootDOM element ID where the search results page will be rendered

Settings Object

The settings object controls feature flags and UI behavior:

SettingTypeDefaultDescription
searchPageURLstringURL for search results page. Use {query} placeholder (e.g., /search?q={query})
mobileVewPortstring | number"900px"Breakpoint for switching to mobile view
productsIndexstringAutoMeilisearch index name. Defaults to searchx_{app_id}_products_index
platformstring"opencart"Hosting platform: "opencart", "custom", or "other"
wishlistEnabledbooleanfalseShow "Add to Wishlist" button on product cards
showIconbooleanfalseShow "Quick Add to Cart" icon on thumbnails
compactPaginationbooleanfalseUse compact pagination style
primaryFacetAttributestring"brand"Primary filter group: "brand" or "categories"
showBrandbooleanfalseDisplay brand name on product cards
showSizesbooleanfalseDisplay available sizes on product cards
showColorbooleanfalseDisplay product color on product cards
showDescriptionbooleanfalseDisplay product description on product cards
showBothFacetsbooleanfalseShow both Category and Brand facets simultaneously
showSizeFilterbooleanfalseShow Size filter in the sidebar
showColorFilterbooleanfalseShow Color filter in the sidebar
defaultPlaceholderstringCustom placeholder text for the search input
cartButtonTextstringCustom "Add to Cart" button text
wishlistButtonTextstringCustom "Add to Wishlist" button text
topSearchesstring[]Popular search terms to display as suggestions

Full Example

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',
  defaultLanguage: 'en',
  settings: {
    searchPageURL: '/search?q={query}',
    mobileVewPort: '900px',
    wishlistEnabled: true,
    showIcon: true,
    compactPagination: true,
    primaryFacetAttribute: 'categories',
    showBrand: true,
    showSizes: true,
    showColor: true,
    showDescription: false,
    showBothFacets: true,
    showSizeFilter: true,
    showColorFilter: true,
    defaultPlaceholder: 'Search for products...',
    cartButtonText: 'Buy Now',
    wishlistButtonText: 'Save for later',
    topSearches: ['Smartphone', 'Laptop', 'Headphones'],
  },
});
Previous
Skroutz Feed