React SDK

Pipeline

The Pipeline class is required to configure which pipeline to use for search queries and must be passed to the SearchProvider.

Usage

Replace the demo information with your account ID and collection ID and pipeline (e.g. 'query') from the console.

Constructor

The constructor accepts the following arguments:

ArgumentTypeDefaultDescription
0{ account: string; collection: string; endpoint?: string;}Account, collection and endpoint configuration.
1string | { name: string; version?: string }The pipeline configuration.
2ClickTracking | NoTrackingnew NoTracking()Default tracking to use in searches.
3ClickTracking | NoTracking[GoogleAnalytics]Default tracking to use in searches.

Properties

For more advanced implementations, you may want to call methods on the Pipeline instance.

NameDescription
search(variables)Perform a search.
listen(event: string, callback: () => void)Register a listener for a specific event.
clearResponse(variables)Clears the error, response, and response variables from this object.
getResponse()Returns the current response.
getAnalytics()Returns the analytics adaptor connected to this pipeline.
getClient()Returns the underlying JavaScript SDK client.

Search example

To perform a search you need a dictionary of parameter key-value pairs.

This will return a Response object.

Listen example

Register listeners to be notified when search responses come back from the server, or are cleared by UI events. Every listener is passed a Response which wraps the server response with convenience methods: