QueryTrigger (Commerce Engine)
QueryTrigger (Commerce Engine)
This is for:
DeveloperThe QueryTrigger
controller handles query trigger query pipeline rules, which let you define a search query to execute when a certain condition is met.
Methods
undo
Undoes a query trigger’s correction.
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 QueryTrigger
controller.
Properties
-
newQuery:
string
The new query returned by a query trigger rule in the query pipeline.
-
originalQuery:
string
The original query that was submitted by the user.
-
wasQueryModified:
boolean
Whether the original query was modified by a trigger rule in the query pipeline.
Initialize
buildQueryTrigger
Creates a QueryTrigger
controller instance.
Parameters
-
engine:
CommerceEngine
The headless commerce engine.
Returns QueryTrigger
Related Types
Unsubscribe
Call signatures
-
(): void;