Skip to main content

SearchIntegration

Overview

This represents the set of search operations available when initializing an integration with the Search function exported by this package. The input parameters and results will vary based on the SearchModes.

note

The full set of operations available will depend on the search vendor. For example, a vendor may not support searchSuggestions, in which case the function won't be implemented.

VendorSearchIntegration

Search Integration as exported by Vendor packages. Extends SearchIntegration, adding attributes specifying the SearchModes for the integration.

SearchModes

Search integrations may behave differently depending on how you want to combine your data models. SearchModes defines the modes available.

lineItemType = 'expanded' | 'reference'

expanded

Results will have full product models attached.

reference

Results will have references to products which will need to be dereferenced to get a full product model.

Functions

getAllProducts

Retrieve all products.

note

Typically this function is only used for core scaffolding features like generating a sitemap.

Parameters

None

Return Value

type: Promise<Result<ProductReference[]>>

A promise that resolves to the result of all products.

searchProducts

Search for products with the given query and parameters.

Parameters

searchInput

type: ProductSearchInput

The input parameters required to search for products.

Return Value

type: Promise<Result<SearchResults<TSearchModes['lineItemType']>>>

A promise that resolves to the result of the product search.

searchHelpers

Retrieve search helpers-- supporting utility functions.

note

This is only sometimes needed for certain vendors.

Parameters

None

Return Value

type: SearchHelpers

The search helpers object.

searchSuggestions

Retrieve simple search suggestions with the given query.

Parameters

suggestInput

type: object

The input parameters required to get search suggestions.

q (optional)

type: string


The query string for search suggestions.

Return Value

type: Promise<Result<SuggestionsResult>>

A promise that resolves to the result of the search suggestions.

searchCategories

Search for categories with the given input.

Parameters

searchInput

type: CategorySearchInput


The input parameters required to search for categories.

handle (optional)

type: string


The handle to identify the category.

Return Value

type: Promise<Result<CategorySearchResults>>

A promise that resolves to the result of the category search.