Return the debug info about this component.
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.
Return the bindings, or environment, for the current component.
Indicates whether the HTMLElement argument is included in the Tab. Included elements are shown when the Tab is selected, whereas excluded elements are not.
The HTMLElement to verify.
true
if the HTMLElement is included in the Tab; false
if it is excluded.
Selects the current Tab.
Also logs the interfaceChange
event in the usage analytics with the new current Tab.options.id as metada
and triggers a new query.
Get the bound component to the given HTMLElement. Throws an assert if the HTMLElement has no component bound, unless using the noThrow argument.
If there is multiple component bound to the current HTMLElement, you must specify the component class.
HTMLElement for which to get the bound component.
Optional component class. If the HTMLElement has multiple components bound, you must specify which one you are targeting.
Boolean option to tell the method to not throw on error.
Allows the component to bind events and execute them only when it is enabled.
Contains the state of options for different components. Mainly used by ResultLink.
Contains the state of different components (enabled vs disabled). Allows to get/set values. Triggers component state event when modified. Each component can listen to those events.
A disabled component will not participate in the query, or listen to ComponentEvents.
Allows component to log in the dev console.
Contains the singleton that allows to trigger queries.
Contains the state of the query. Allows to get/set values. Trigger query state event when modified. Each component can listen to those events.
A reference to the root HTMLElement (the SearchInterface).
A reference to the root of every component, the SearchInterface.
The static ID that each component needs in order to be identified.
For example, SearchButton -> static ID: SearchButton -> className: CoveoSearchButton
A reference to the Analytics.client.
Specifies the caption of the Tab.
Specifying a value for this option is necessary for this component to work.
data-caption='foo'
Specifies whether to include the Tab.options.expression in the constant part of the query.
The index specially optimizes the constant part of the query to execute faster. However, you must be careful not to include dynamic query expressions, otherwise the cache will lose its efficiency.
Default value is true
.
data-constant='true' data-constant='false'
Specifies the label of the button that allows to show the hidden tabs when in responsive mode.
If more than one Tab in the search interface specifies a value for this option, then the framework uses the first occurrence of the option.
The default value is "More"
.
data-dropdown-header-label='foo'
Whether to filter out duplicates, so that items resembling one another only appear once in the query results.
Notes:
data-enable-duplicate-filtering='true' data-enable-duplicate-filtering='false'
Specifies whether to enable responsive mode for tabs. Responsive mode makes overflowing tabs disappear, instead making them available using a dropdown button. Responsive tabs are enabled either when tabs overflow or when the width of the search interface becomes too small.
Disabling responsive mode for one Tab also disables it for all tabs. Therefore, you only need to set this option
to false
on one Tab to disable responsive mode.
Default value is true
.
data-enable-responsive-mode='true' data-enable-responsive-mode='false'
Specifies the SearchEndpoint to point to when performing queries from within the Tab.
By default, the Tab uses the "default" endpoint.
Specifies an advanced expression or filter that the Tab should add to any outgoing query.
Example:
@objecttype==Message
Default value is undefined
and the Tab applies no additional expression or filter to the query.
data-expression='foo'
Specifies an icon to use for the Tab.
data-icon='foo'
Specifies a unique ID for the Tab.
Specifying a value for this option is necessary for this component to work.
data-id='foo'
Specifies the default layout to display when the user selects the Tab (see ResultList.options.layout and {@link ResultLayout}).
See the ValidLayout type for the list of possible values.
If not specified, it will default to 'list'.
See also Result Layouts.
Default value is undefined
and the component selects the first available layout.
Specifies the maximum age (in milliseconds) that cached query results can have to still be usable as results instead of performing a new query on the index from within the Tab. The cache is located in the Coveo Search API (which resides between the index and the search interface).
If cached results that are older than the age you specify in this option are available, a new query will be performed on the index anyhow.
On high-volume public web sites, specifying a higher value for this option can greatly improve query response time at the cost of result freshness.
Note:
It is also possible to set a maximum cache age for the entire SearchInterface rather than for a single Tab (see SearchInterface.options.maximumAge).
Default value is undefined
and the Coveo Search API determines the maximum cache age. This is typically
equivalent to 30 minutes (see maximumAge).
data-maximum-age='10'
Specifies the name of the query pipeline to use for the queries when the Tab is selected.
You can specify a value for this option if your index is in a Coveo Cloud organization in which pipelines have been created (see Adding and Managing Query Pipelines).
Default value is undefined
, which means that pipeline selection conditions defined in the Coveo Cloud
organization apply.
data-pipeline='foo'
Specifies the default sort criteria to use when selecting the Tab. A Sort component with the same parameter needs to be present in the search interface in order for this option to function properly.
Examples:
data-sort='relevancy'
data-sort='date descending'
Default value is undefined
and the normal Sort component behavior applies.
data-sort='foo'
Creates a new Tab. Binds on buildingQuery event as well as an event on click of the element.
The HTMLElement on which to instantiate the component. Normally a div
.
The options for the Tab component.
The bindings that the component requires to function normally. If not set, these will be automatically resolved (with a slower execution time).
The Tab component renders a widget that allows the end user to select a specific search interface.
This component attaches itself to a
div
element. It is in charge of adding an advanced expression to the outgoing query in order to refine the results.The Tab component can also hide and show different parts of the UI. For each individual component in the UI, you can specify whether you wish to include or exclude that component when the user selects a certain Tab (see Using Components Only on Specific Tabs).
Setting a New Endpoint for a Tab:
A Tab can use a custom endpoint when performing a query. Of course, you need to make sure that the endpoint exists in the array of Coveo.SearchEndpoint.endpoints (see SearchEndpoint.endpoints).
Coveo.SearchEndpoint.endpoints["specialEndpoint"] = new Coveo.SearchEndpoint({ restUri : 'https://somewhere.com/rest/search' }) [ ... ] <div class='CoveoTab' data-endpoint='specialEndpoint'></div>