Attaches a component to the search interface. This allows the search interface to easily list and iterate over its components.
Normally, the component type is a unique identifier without the Coveo
prefix (e.g., CoveoFacet
->
Facet
, CoveoPager
-> Pager
, CoveoQuerybox
-> Querybox
, etc.).
The component instance to attach.
Return the debug info about this component.
Detaches a component from the search interface.
Normally, the component type is a unique identifier without the Coveo
prefix (e.g., CoveoFacet
->
Facet
, CoveoPager
-> Pager
, CoveoQuerybox
-> Querybox
, etc.).
The component instance to detach.
Detaches from the SearchInterface every component that is inside the given element.
Disable the component. Normally this means that the component will not execute handlers for the framework events (query events, for example). Components are enabled by default on creation.
Enable the component. Normally this means that the component will execute handlers for the framework events (query events, for example). Components are enabled by default on creation.
Returns the bindings, or environment, for the current component.
Gets all the components of a given type.
Normally, the component type is a unique identifier without the Coveo
prefix (e.g., CoveoFacet
->
Facet
, CoveoPager
-> Pager
, CoveoQuerybox
-> Querybox
, etc.).
Gets the query context for the current search interface.
If the search interface has performed at least one query, it will try to resolve the context from the last query sent to the Coveo Search API.
If the search interface has not performed a query yet, it will try to resolve the context from any avaiable PipelineContext component.
If multiple PipelineContext components are available, it will merge all context values together.
Note: Having multiple PipelineContext components in the same search interface is not recommended, especially if some context keys are repeated across those components.
If no context is found, returns undefined
A disabled component will not participate in the query, or listen to ComponentEvents.
Allows component to log in the dev console.
Allows to get and set the different breakpoints for mobile and tablet devices.
This is useful, amongst other, for Facet, Tab and ResultList
The static ID that each component needs in order to be identified.
For example, SearchButton -> static ID: SearchButton -> className: CoveoSearchButton
If Recommendation.options.enableResponsiveMode is true
for all Recommendation components, specifies the
label of the dropdown button that allows to display the Recommendation components when in responsive mode.
If more than one Recommendation component in the search interface specifies a value for this option, then the framework uses the first occurrence of the option.
Default value is Recommendations
.
data-dropdown-header-label='foo'
Specifies whether to enable responsive mode for Recommendation components. Setting this options to false
on
any Recommendation component in a search interface disables responsive mode for all other Recommendation
components in the search interface.
Responsive mode displays all Recommendation components under a single dropdown button whenever the width of the HTML element which the search interface is bound to reaches or falls behind a certain threshold (see Recommendation.options.responsiveBreakpoint).
See also Recommendation.options.dropdownHeaderLabel.
Default value is true
.
data-enable-responsive-mode='true' data-enable-responsive-mode='false'
Specifies whether to hide the Recommendations component if no result or recommendation is available.
Default value is true
.
data-hide-if-no-results='true' data-hide-if-no-results='false'
Specifies the ID of the interface. The usage analytics use the interface ID to know which recommendation interface was selected.
Default value is Recommendation
for the first one and Recommendation_{number}
, where {number} depends on the
number of Recommendation interfaces with default IDs in the page for the others.
data-id='foo'
Specifies the main SearchInterface to listen to.
Specifies which options from the main QueryBuilder to use in the triggered query.
Possible values are:
expression
advancedExpression
constantExpression
disjunctionExpression
Example:
Adding the expression (q
) and the advanced expression (aq
) parts of the main query in the triggered query:
data-options-to-use="expression,advancedExpression"
Default value is expression
.
If Recommendation.options.enableResponsiveMode is true
for all Recommendation components, specifies the
width threshold (in pixels) of the search interface at which Recommendation components go in responsive mode.
Recommendation components go in responsive mode when the width of the search interface is equal to or lower than this value.
The search interface
corresponds to the HTML element with the class CoveoSearchInterface
.
If more than one Recommendation component in the search interface specifies a value for this option, then the framework uses the last occurrence of the option.
Default value is 1000
.
data-responsive-breakpoint='10'
Specifies whether to send the actions history along with the triggered query.
Setting this option to false
makes it impossible for this component to get Coveo Machine Learning
recommendations.
However, setting this option to false
can be useful to display side results in a search page.
Default value is true
.
data-send-actions-history='true' data-send-actions-history='false'
Specifies the user context to send to Coveo usage analytics. The component sends this information with the query alongside the user history to get the recommendations.
Creates a new Recommendation component.
The HTMLElement on which to instantiate the component.
The options for the Recommendation component.
The Recommendation component is a SearchInterface that displays recommendations typically based on user history.
This component usually listens to the main SearchInterface. When the main SearchInterface generates a query, the Recommendation component generates another query to get the recommendations at the same time.
To get history-based recommendations, you will likely want to include the
pageview
script in your page (see coveo.analytics.js). However, including this script is not mandatory. For instance, you could use the Recommendation component without the Coveo Machine Learning service to create a simple "recommended people" interface.It is possible to include this component inside another SearchInterface, but it is also possible to instantiate it as a "standalone" search interface, without even instantiating a main SearchInterface component. In any case, a Recommendation component always acts as a full-fledged search interface. Therefore, you can include any component inside the Recommendation component (Searchbox, Facet, Sort, etc.), just as you would inside the main SearchInterface component.
July 2016 Release (v1.667.24)