FacetManager (Insight Engine)
FacetManager (Insight Engine)
This is for:
DeveloperThe FacetManager
controller helps reorder facets to match the most recent search response.
Example: facet-manager.fn.tsx
Methods
sort
Sorts the facets to match the order in the most recent search response.
Parameters
-
facets:
FacetManagerPayload<T>[]
An array of facet payloads to sort.
Returns FacetManagerPayload<T>[]
: A sorted array.
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 CoreFacetManager
controller.
Properties
-
facetIds:
string[]
The facet ids sorted in the same order as the latest response.
Initialize
buildFacetManager
Creates an insight FacetManager
instance.
Parameters
-
engine:
InsightEngine
The insight engine.
Returns FacetManager
Related Types
FacetManagerPayload<T>
Properties
-
facetId:
string
A unique string identifying a facet.
-
payload:
T
The payload to associate with the facetId. This can be anything e.g., a DOM element, JSX, a string.
Unsubscribe
Call signatures
-
(): void;