QueryTrigger (Commerce Engine)

This is for:

Developer
Important

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 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

Unsubscribe

Call signatures

  • (): void;