vtex.search does not own a server-side data model. It is a Store Framework app rendering blocks and exposing one client utility (BiggyClient) that issues Apollo queries against vtex.store-resources. The "model" is therefore the contract between Autocomplete UI components, the GraphQL responses from store-resources, and the local cookies written by this app.
Block contract (from store/interfaces.json)
| Block name | React component | Required children |
|---|---|---|
autocomplete-result-list.v2 | Autocomplete (react/Autocomplete.js) | product-summary (vtex.product-summary) |
did-you-mean | DidYouMean (react/DidYouMean.js) | — |
search-suggestions | Suggestions (react/Suggestions.js) | — |
search-banner | Banner (react/Banner.js) | — |
For prop-level configuration (block content schemas, CSS handles), see the per-block markdown under docs/.
Client surface — BiggyClient (react/utils/biggy-client.ts)
BiggyClient is constructed with an Apollo ApolloClient<any> instance and exposes three query methods plus history helpers.
topSearches()
_10topSearches(): Promise<ApolloQueryResult<{ topSearches: ISearchesOutput }>>
Issues vtex.store-resources/QueryTopSearches. Returns the platform's currently popular search terms. No variables.
suggestionSearches(term)
_10suggestionSearches(term: string): Promise<ApolloQueryResult<{ autocompleteSearchSuggestions: ISearchesOutput }>>
Issues vtex.store-resources/QueryAutocompleteSearchSuggestions with { fullText: term }. Returns text-side autocomplete suggestions.
suggestionProducts(term, ...)
_12suggestionProducts(_12 term: string,_12 attributeKey?: string,_12 attributeValue?: string,_12 productOrigin = false,_12 simulationBehavior: 'default' | 'skip' | null = 'default',_12 hideUnavailableItems = false,_12 orderBy?: string,_12 count?: number,_12 shippingOptions?: string[],_12 advertisementOptions?: AdvertisementOptions_12): Promise<ApolloQueryResult<{ productSuggestions: IProductsOutput }>>
Issues vtex.store-resources/QuerySuggestionProducts with the named variables plus:
variant← cookiesp-variant(A/B routing)origin←'autocomplete'
Uses fetchPolicy: 'network-only' (autocomplete should never serve stale Apollo cache).
Backwards compatibility: Adding new optional params is safe. Removing or reordering existing ones is breaking for host apps importing
BiggyClient.
History helpers
_10searchHistory(): string[]_10prependSearchHistory(term: string, limit = 5): void
Read/write the biggy-search-history cookie. Format: comma-joined list capped at 5 entries. Empty terms are ignored. Existing terms are deduped (moved to the front).
Response shapes
_20interface ISearchesOutput {_20 searches: {_20 term: string_20 count: number_20 attributes: Array<{_20 key: string_20 value: string_20 labelKey: string_20 labelValue: string_20 }>_20 }[]_20}_20_20interface IProductsOutput {_20 products: ISearchProduct[] // see react/models/search-product_20 count: number_20 misspelled: boolean_20 operator: string_20 searchId: string_20}
The shape of ISearchProduct is owned by the IS backend and surfaced through vtex.store-resources. Treat it as external.
Cookies and local storage
| Key | Type | Owner | Purpose |
|---|---|---|---|
biggy-search-history | cookie | this repo | Local search history for the autocomplete dropdown. Format: comma-joined list, max 5 entries. |
sp-variant | cookie | external (IS A/B routing) | Read-only here. Forwarded to IS as the variant GraphQL variable. |
This app does not read or write localStorage['vtex.search.pickupInPoint'] (owned by vtex.delivery-promise-components).