Sort (Insight Engine) (Deprecated)
Sort (Insight Engine) (Deprecated)
|
Headless v1 has been deprecated. We recommend using the latest version of the Coveo Headless library. |
The Sort
controller manages how the results are sorted.
Methods
isSortedBy
Checks whether the specified sort criterion matches the value in state.
Parameters
-
criterion:
SortCriterion | SortCriterion[]
The criterion to compare.
Returns boolean
: true
if the passed sort criterion matches the value in state, and false
otherwise.
sortBy
Updates the sort criterion and executes a new search.
Parameters
-
criterion:
SortCriterion | SortCriterion[]
The new sort criterion.
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.
Initialize
buildSort
Creates an insight Sort
controller instance.
Parameters
-
engine:
InsightEngine
The insight engine.
-
props:
SortProps
The configurable
Sort
controller properties.
Returns Sort
SortProps
The configurable Sort
controller properties.
Properties
-
initialState?:
SortInitialState
The initial state that should be applied to this
Sort
controller.