useInstantSearch
call that returns products, collections, pages, keyword suggestions and autocorrect — and a
trending block when the query is empty.
Prerequisite: the search app is registered (
.use(search())), your app is wrapped in
<GloodProvider>, and https://search.glood.ai is in your CSP connectSrc. See
Installation.1. Wire the input to useInstantSearch
Keep the query in state and gate fetching with options.skip until it clears the minimum
length. The minimum comes from the config (minimum_type_ahead_input_count), read via
useSearchConfig.
InstantSearchParams
(objects selects which result blocks to return); data is an
InstantSearchResponse.
config is a SearchConfigResponse.
2. Render suggestions, autocorrect and products
products, suggestions and collections are convenience accessors; the full response
(articles, autocorrect, trending, metadata) is on data.
SearchSuggestion,
each product a SearchProduct.
3. Trending empty state
The same response carries atrending block whenever the query is empty or below the minimum
length — no extra call. Drop the skip gate so it fetches on an empty query, tune it with the
trending param (InstantSearchTrendingParams),
and read data.trending:
4. Submit to the results page
On Enter or click, navigate to your Search Page (/search?q=<term>). Standard search_submitted events are forwarded automatically once
search() is registered; for explicit attribution call
trackSearch from
useGloodAnalytics().getApp('search') (see Events & attribution).
See also
useInstantSearch— full returnsfetchInstantSearch— SSR / non-React- Search Page