Skip to main content

Prepare and get flow

In v3 the search controller handles prepare and execute automatically. When you call get(), the controller prepares the query if needed and retries a 425 response until results are ready.
For advanced use cases, you can call prepare() directly to cache expensive work before calling get().

Passing search IDs between pages

A searchId returned from prepare() is valid for a short window and can be reused across page navigations to keep ranking and merchandising consistent.
On the results page, read the searchId and pass it to a new search controller.

Debouncing autocomplete

For search-as-you-type, use autocomplete() and debounce the input in your framework or with createDebounce() from the SDK.
The deprecated suggest() method also debounces, but new integrations should use autocomplete() with their own debounce logic.

Concurrent API calls

Call search.prepare() and autocomplete.get() concurrently for a fast search-as-you-type experience.

Aborting stale requests

Controllers are tied to a single request lifecycle. To abort a previous request (for example, when the shopper types a new character), dispose the old controller and create a new one.

Next steps

Caching

Learn how the SDK caches requests and results.

Performance

Optimize your implementation for speed.