A context, as returned by SearchInterface.getQueryContext or PipelineContext.getContext
The IAnalyticsDocumentViewMeta
interface describes the expected metadata when logging a click event / item view.
See also the Analytics
component, and more specifically its
logClickEvent
method.
The author of the clicked item.
The title of the clicked item.
The URL of the clicked item.
The IQueryExpression
type is a string type dedicated to query expressions.
This type is used to build a specific option for query expressions.
The format of a successful response.
The possible valid and supported layouts.
See the Result Layouts documentation.
The allowed Quickview
tooltipPlacement
option values. The -start
and -end
variations indicate relative alignement. Horizontally (top
, bottom
), -start
means left and -end
means right. Vertically (left
, right
), -start
means top and -end
means bottom. No variation means center.
Convenience wrapper for the Dom class. Used to do $$(element).
If passed with an argument which is not an HTMLElement, it will call Dom.createElement.
Adds a new analytics action cause to the ActionCauseList. Adding a new actionCause allows to specify a custom user-action when triggering a search event.
(e.g., { Name: "newActionCause", Type: "exampleType" },
Removes all session information stored in the browser (e.g., analytics visitor cookies, action history, etc.)
The element to scan for an Analytics component. This can be an element onto which a component instance is bound (e.g., document.querySelector(".CoveoAnalytics"), or an ancestor of such an element (e.g., document.getElementById("search").
Sets the path from where the chunks used for lazy loading will be loaded. In some cases, in IE11, we cannot automatically detect it, use this instead.
This should be the path of the Coveo script. It should also have a trailing slash.
Disables an Analytics
component and clears local data.
The element to scan for an Analytics component. This can be an element onto which a component instance is bound (e.g., document.querySelector(".CoveoAnalytics"), or an ancestor of such an element (e.g., document.getElementById("search").
Re-enables an Analytics
component if it was previously disabled.
The element to scan for an Analytics component. This can be an element onto which a component instance is bound (e.g., document.querySelector(".CoveoAnalytics"), or an ancestor of such an element (e.g., document.getElementById("search").
Execute a standard query. Active component in the interface will react to events/ push data in the query / handle the query success or failure as needed.
It triggers a standard query flow for which the standard component will perform their expected behavior.
If you wish to only perform a query on the index to retrieve results (without the component reacting), look into SearchInterface instead.
Calling this method is the same as calling QueryController.executeQuery.
The root of the interface to initialize.
Get the component bound on the given HTMLElement
.
The HTMLElement
for which to get the component instance.
If multiple components are bound to a single HTMLElement
, you need to specify which components you wish to get.
By default, the GET method will throw if there is no component bound, or if there are multiple component and no componentClass
is specified. This deletes the error if set to true.
Initialize the framework with a basic search interface. Calls Initialization.initSearchInterface.
If using the jQuery extension, this is called using $('#root').coveo('init');
.
The root of the interface to initialize.
JSON options for the framework (e.g.: {Searchbox : {enableSearchAsYouType : true}}
).
}
Initialize the framework with a recommendation interface. Calls Initialization.initRecommendationInterface.
If using the jQuery extension, this is called using $('#root').coveo('initRecommendation');
.
The root of the interface to initialize.
The search interface to link with the recommendation interface (see Recommendation).
The user context to pass with the query generated in the recommendation interface (see Recommendation).
JSON options for the framework (e.g.: {Searchbox : {enableSearchAsYouType: true}}
).
}
Initialize the framework with a standalone search box. Calls {@link Initialize.initStandaloneSearchInterface}.
If using the jQuery extension, this is called using $('#root').coveo('initSearchbox');
.
The root of the interface to initialize.
The search page on which to redirect when there is a query.
JSON options for the framework (e.g.: {Searchbox : {enableSearchAsYouType : true}}
).
}
Asynchronously loads a module, or chunk.
This is especially useful when you want to extend a base component, and make sure the lazy component loading process recognizes it (see Lazy Versus Eager Component Loading).
Example:
export function lazyCustomFacet() {
return Coveo.load<Facet>('Facet').then((Facet) => {
class CustomFacet extends Facet {
[ ... ]
};
Coveo.Initialization.registerAutoCreateComponent(CustomFacet);
return CustomFacet;
});
};
Coveo.LazyInitialization.registerLazyComponent('CustomFacet', lazyCustomFacet);
You can also use this function to assert a component is fully loaded in your page before executing any code relating to it.
Example:
You could do
Coveo.load('Searchbox').then((Searchbox) => {})
to load theSearchbox
component, if it is not already loaded in your search page.
The identifier of the module you wish to load. In the case of components, this identifier is the component
name (e.g., Facet
, Searchbox
).
A Promise of the module, or chunk.
Finds the Analytics
component instance, and uses it to log a Click
usage analytics event.
A Click
event corresponds to an item view (e.g., clicking on a ResultLink or opening a Quickview).
Click
events are immediately sent to the Coveo Usage Analytics service.
The root of the search interface which contains the Analytics
component.
The cause of the event.
The metadata you want to use to create custom dimensions. Metadata can contain as many key-value
pairs as you need. Each key must contain only alphanumeric characters and underscores. The Coveo Usage Analytics
service automatically converts white spaces to underscores, and uppercase characters to lowercase characters in key
names. Each value must be a simple string. If you do not need to log metadata, you can simply pass an empty JSON
( {}
).
The result that was clicked.
Finds the Analytics
component instance, and uses it to log a Custom
usage analytics event.
You can use Custom
events to create custom reports, or to track events which are neither queries nor item
views.
The root of the search interface which contains the Analytics
component.
The cause of the event.
The metadata you want to use to create custom dimensions. Metadata can contain as many key-value
pairs as you need. Each key must contain only alphanumeric characters and underscores. The Coveo Usage Analytics
service automatically converts white spaces to underscores, and uppercase characters to lowercase characters in key
names. Each value must be a simple string. If you do not need to log metadata, you can simply pass an empty JSON
( {}
).
The query result that relates to the custom event, if applicable.
Finds the Analytics
component instance, and uses it to log a SearchAsYouType
usage analytics
event.
This function is very similar to the logSearchEvent
function, except that logSearchAsYouTypeEvent
should, by
definition, be called more frequently. Consequently, in order to avoid logging every single partial query, the
PendingSearchAsYouTypeEvent
takes care of logging only the "relevant" last event: an event that occurs after 5
seconds have elapsed without any event being logged, or an event that occurs after another part of the interface
triggers a search event.
It is important to call this method before executing the query. Otherwise, no SearchAsYouType
event will be
logged, and you will get a warning message in the console. See
Logging Your Own Search Events.
The root of the search interface which contains the Analytics
component.
The cause of the event.
The metadata you want to use to create custom dimensions. Metadata can contain as many key-value
pairs as you need. Each key must contain only alphanumeric characters and underscores. The Coveo Usage Analytics
service automatically converts white spaces to underscores, and uppercase characters to lowercase characters in key
names. Each value must be a simple string. If you do not need to log metadata, you can simply pass an empty JSON
( {}
).
Finds the Analytics
component instance, and uses it to log a Search
usage analytics event.
A Search
event is actually sent to the Coveo Usage Analytics service only after the query successfully returns (not
immediately after calling this method). Therefore, it is important to call this method before executing the
query. Otherwise, the Search
event will not be logged, and you will get a warning message in the console. See
Logging Your Own Search Events.
The root of the search interface which contains the Analytics
component.
The cause of the event.
The metadata you want to use to create custom dimensions. Metadata can contain as many key-value
pairs as you need. Each key must contain only alphanumeric characters and underscores. The Coveo Usage Analytics
service automatically converts white spaces to underscores, and uppercase characters to lowercase characters in key
names. Each value must be a simple string. If you do not need to log metadata, you can simply pass an empty JSON
( {}
).
Pass options to the framework, before it is initialized (init).
All the options passed with this calls will be merged together on initialization.
The root of the interface for which you wish to set options.
JSON options for the framework (e.g.: {Searchbox : {enableSearchAsYouType: true}}
).
Patch the given methodName
on an instance of a component bound to an HTMLElement
with a new handler.
IE11 equivalent of Promise.race Adapted from Promise.race(iterable) polyfill on https://www.promisejs.org/api/
Removes an actionCause from the ActionCauseList.
Performs read and write operations on the QueryStateModel
instance of the search
interface. See State.
Can perform the following actions:
Get the QueryStateModel
instance:
Coveo.state(element);
Get the value of a single state attribute from the QueryStateModel
instance:
// You can replace `q` with any registered state attribute.
Coveo.state(element, "q");
Set the value of a single state attribute in the QueryStateModel
instance:
// You can replace `q` with any registered state attribute.
Coveo.state(element, "q", "my new value");
Set multiple state attribute values in the QueryStateModel
instance:
// You can replace `q` and `sort` with any registered state attributes.
Coveo.state(element, {
"q" : "my new value",
"sort" : "relevancy"
});
Note:
When setting one or several state attribute values with this function, you can pass an additional argument to set the
silent
attribute totrue
in order to prevent the state change from triggering state change events.Example:
Coveo.state(element, "q", "my new value", { "silent" : true });
The root of the interface whose QueryStateModel
instance the function should interact with.
The arguments that determine the action to perform on the QueryStateModel
instance.
Depends on the action performed.
ResponsiveFacets options
If the [enableResponsiveMode
]{@link Facet.options.enableResponsiveMode} option is true
for all facets and
{@link FacetSlider.options.enableResponsiveMode} is also true
for all sliders, specifies the label of the
dropdown button that allows to display the facets when in responsive mode.
If more than one Facet
or FacetSlider component in the search interface specifies a value for this
option, the framework uses the first occurrence of the option.
Default value is Filters
.
Specifies whether to enable responsive mode for facets. Setting this options to false
on any Facet
, or
FacetSlider
component in a search interface disables responsive mode for all other facets
in the search interface.
Responsive mode displays all facets 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 SearchInterface.responsiveComponents).
See also the [dropdownHeaderLabel
]{@link Facet.options.dropdownHeaderLabel} option.
Default value is true
.
The basic types of form available to build an advanced search section.