RecentQueriesList (Commerce Engine)
RecentQueriesList (Commerce Engine)
This is for:
Developer
The Headless commerce engine, controllers, and actions are in open beta and therefore under active development. Reach out to your Coveo team for support in adopting them. |
The RecentQueriesList
controller manages the user’s recent queries.
Methods
clear
Clears the recent queries list.
executeRecentQuery
Executes the given recent query.
Parameters
-
index:
number
The index of the recent query to execute.
subscribe
Adds a callback that’s invoked on state change.
Parameters
-
listener:
() => void
A callback that’s invoked on state change.
Returns Unsubscribe
: A function to remove the listener.
Attributes
state
The state of the RecentQueriesList controller.
Properties
-
analyticsEnabled:
boolean
Whether analytics & tracking are enabled. In the case where it is disabled, it is recommended not to save recent queries.
-
maxLength:
number
The maximum number of queries to retain in the list.
-
queries:
string[]
The list of recent queries.
Initialize
buildRecentQueriesList
Creates a RecentQueriesList
controller instance.
Parameters
-
engine:
CommerceEngine
The headless engine.
-
props:
RecentQueriesListProps
The configuration
RecentQueriesList
properties.
Returns RecentQueriesList
RecentQueriesListProps
The configuration RecentQueriesList
properties.
Properties
-
initialState?:
RecentQueriesListInitialState
The initial state that should be applied to the
RecentQueriesList
controller. -
options?:
RecentQueriesListOptions
The configuration options that should be applied to the
RecentQueriesList
controller.
RecentQueriesListInitialState
The initial state that should be applied to the RecentQueriesList
controller.
Properties
-
queries:
string[]
The list of recent queries.
Default:
[]
RecentQueriesListOptions
The configuration options that should be applied to the RecentQueriesList
controller.
Properties
-
maxLength:
number
The maximum number of queries to retain in the list.
Default:
10
-
clearFilters?:
boolean
Whether to clear all active query filters when the end user submits a new query from the recent queries list. Setting this option to "false" is not recommended & can lead to an increasing number of queries returning no results.
Related Types
Unsubscribe
Call signatures
-
(): void;