Home > widget-integration > InstantSearchAPI
InstantSearchAPI class
API service for instant search operations.
Technical Support teams can extend this service for custom API behavior:
Signature:
export declare class InstantSearchAPI extends BoostAPI
Extends: BoostAPI
Example
window.boostWidgetIntegration.extend('InstantSearchAPI', (InstantSearchAPI) => {
return class CustomInstantSearchAPI extends InstantSearchAPI {
// Add custom headers
protected buildHeaders() {
return {
...super.buildHeaders(),
'X-Custom-Header': 'value'
};
}
};
});
Constructors
|
Constructor |
Modifiers |
Description |
|---|---|---|
|
(constructor)(platformLoader, appService, b2bService, recentSearchService) |
Constructs a new instance of the |
Properties
|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
| |||
|
|
{ enabled: boolean; companyLocationId?: string; } |
Get B2B configuration. | |
|
| |||
|
|
string |
Get the base search API URL. | |
|
|
boolean |
Enable debug logging | |
|
|
string |
Get the current locale. | |
|
| |||
|
| |||
|
|
Partial<SearchSettings$1> |
Get search settings from app config. | |
|
|
string |
Get the tenant/shop domain. | |
|
|
string |
Get the template API URL. |
Methods
|
Method |
Modifiers |
Description |
|---|---|---|
|
|
Build API URL for external Boost search service. NOTE: The locale is passed as a query parameter ( | |
|
|
Build request headers. Override to add custom headers. | |
|
|
Build query parameters for API requests. **Legacy**: buildQueryParams() in api/search.js **New**: Method on API service with better typing Handles: - Array values (appended as multiple params) - Custom params from window.boostSdCustomParams - Customer ID from platform | |
|
|
Build request payload enriched with shared localization, customer, and optional B2B data. | |
|
|
Build query parameters enriched with shared localization, customer, and B2B data. | |
|
|
Build the raw request parameters object for a suggestion API call. Primary extension point for TS teams who need to inject custom search parameters, override default values, or add shop-specific query flags without re-implementing the full Called by | |
|
|
Enrich a suggestion response with shop-specific data. Called by | |
|
Fetch products by handles. **Legacy**: getProductsDetailByHandle(context, handle, searchQuery) **New**: getProductsByHandle(handles, options?) with typed response Features migrated from legacy: - Single or multiple handles support - Product availability filtering - B2B support - POST method for larger payloads | ||
|
Fetch products by IDs. **Legacy**: getProductsDetail(context, ids) **New**: getProductsById(ids, options?) with typed response Features migrated from legacy: - Product availability filtering - B2B support - Locale params | ||
|
Fetch redirect mappings for search terms. **Legacy**: getRedirects(context, terms) **New**: getRedirects(terms?) with typed response Features migrated from legacy: - Multiple terms support - B2B support - Locale params - Proper response transformation | ||
|
getSuggestions(params, searchSettings, customParams, signal) |
Fetch search suggestions. **Legacy**: getSuggestionSearch(context, query, customizeSearchParams) **New**: getSuggestions(params, searchSettings?, customParams?) with typed response Features migrated from legacy: - Timestamp cache busting (t param) - Did-you-mean suggestions (re_run_if_typo) - Suggestion blocks with limits - Recent search integration - Fuzzy search options - Product availability filtering - B2B support - Locale/currency params | |
|
Fetch ISW template by ID. **Legacy**: getTemplateByIds() in api/template.js **New**: getTemplate(templateId) with proper typing Query params must match the legacy format exactly: - NOTE: This endpoint does NOT accept | ||
|
|
Handle a raw suggestion API response before returning it to the service. Delegates to | |
|
|
Log debug messages when debug mode is enabled. | |
|
|
Execute a JSON request with shared error handling. | |
|
|
Save query string to localStorage. | |
|
Enable or disable debug mode for API logging. | ||
|
|
Strip HTML tags from text. |