Actions

This page lists the various Coveo Headless actions available in version 0.1.0-alpha.4.

Analytics Actions

logGenericSearchEvent

Log generic search event

logInterfaceChange

logInterfaceLoad

Log interface load

Configuration Actions

disableAnalytics

Disable analytics tracking

enableAnalytics

Enable analytics tracking

renewAccessToken

Renew the accessToken specified in the global headless engine configuration.

Parameters:

  • renew: A function that fetches a new access token. The function must return a Promise that resolves to a string (the new access token).

setOriginLevel2

Set originLevel2 for analytics tracking

setOriginLevel3

Set originLevel3 for analytics tracking

updateAnalyticsConfiguration

Update the analytics configuration.

Parameters:

  • enabled: Specifies if usage analytics tracking should be enabled.

  • originLevel2: Specifies the origin level 2 usage analytics event metadata whose value should typically be the name/identifier of the tab from which the usage analytics event originates.

  • originLevel3: Specifies the origin level 3 usage analytics event metadata whose value should typically be the URL of the page that linked to the search interface that’s making the request.

  • apiBaseUrl: The Usage Analytics API base URL to use (e.g., https://platform.cloud.coveo.com/rest/ua).

updateBasicConfiguration

Update the global headless engine configuration.

Parameters:

  • accessToken: The access token to use to authenticate requests against the Coveo Cloud endpoints. Typically, this will be an API key or search token that grants the privileges to execute queries and push usage analytics data in the target Coveo organization.

  • organizationId: The unique identifier of the target Coveo organization (e.g., mycoveocloudorganizationg8tp8wu3)

  • platformUrl: The Plaform URL to use (e.g., https://platform.cloud.coveo.com).

updateSearchConfiguration

Update the search configuration.

Parameters:

  • apiBaseUrl: The Search API base URL to use (e.g., https://platform.cloud.coveo.com/rest/search/v2).

  • pipeline: Specifies the name of the query pipeline to use for the query. If not specified, the default query pipeline will be used.

  • searchHub: The first level of origin of the request, typically the identifier of the graphical search interface from which the request originates.

Context Actions

addContext

Add a new value context value.

Parameters:

  • object: The key value pair to add to the context.

nonEmptyArray

nonEmptyString

removeContext

Add a new value context value.

Parameters:

  • object: The key value pair to remove from the context.

setContext

Set the context of the query.

Parameters:

  • Context: The new context to use.

Did-You-Mean Actions

didYouMeanCorrection

disableDidYouMean

enableDidYouMean

logDidYouMeanAutomatic

Log a did you mean click

logDidYouMeanClick

Log a did you mean click

Facet Actions

Generic Facet Actions

deselectAllFacetValues

Deselects all facet values.

Parameters:

  • id: The unique identifier of the facet.

registerFacet

Register a facet in the facet set.

Parameters:

  • FacetRegistrationOptions: The options to register the facet with.

toggleSelectFacetValue

Select (unselect) a facet value if unselected (selected).

updateFacetIsFieldExpanded

Update whether the facet is expanded (showing more values than initially configured) or not.

updateFacetNumberOfValues

Updates the number of values of a facet.

updateFacetSortCriterion

Updates the sort criterion of a facet.

logFacetClearAll

Log a facet clear all event.

Parameters:

  • facetId: The unique identifier for the facet.

logFacetDeselect

Log the deselected facet value.

logFacetSearch

Log a facet search.

logFacetSelect

Log the selected facet value.

logFacetShowLess

Log a facet show less.

logFacetShowMore

Log a facet show more.

logFacetUpdateSort

Log a facet sort change.

Facet Search Actions

registerCategoryFacetSearch

Register a category facet search in the category facet search set.

Parameters:

  • FacetSearchOptions: The options to register the facet search with.

executeFacetSearch

Executes a facet search.

Parameters:

  • facetId: The facet id on which to execute the search.

registerFacetSearch

Register a facet search in the facet search set.

Parameters:

  • FacetSearchOptions: The options to register the facet search with.

selectFacetSearchResult

Adds a facet search value to the facet.

Parameters:

  • .:

updateFacetSearch

Updates the options of a facet search.

Parameters:

  • FacetSearchOptions: The options to register the facet search with.

Category Facet Actions

deselectAllCategoryFacetValues

Deselects all values of a category facet.

registerCategoryFacet

Register a category facet in the category facet set.

Parameters:

  • CategoryFacetRegistrationOptions: The options to register the category facet with.

toggleSelectCategoryFacetValue

Select (unselect) a category facet value if unselected (selected).

updateCategoryFacetNumberOfValues

Updates the number of values of a category facet.

updateCategoryFacetSortCriterion

Updates the the sort criterion for the category facet

Range Facet Actions

deselectAllDateFacetValues

Deselects all values of a date facet.

registerDateFacet

Register a date facet.

Parameters:

  • DateFacetRegistrationOptions: The options to register the facet with.

toggleSelectDateFacetValue

Select (unselect) a date facet value if unselected (selected).

updateDateFacetSortCriterion

Updates the sort criterion of a date facet.

updateRangeFacetSortCriterion

Updates the sort criterion of a range facet.

deselectAllNumericFacetValues

Deselects all values of a numeric facet.

registerNumericFacet

Register a numeric facet.

Parameters:

  • NumericFacetRegistrationOptions: The options to register the facet with.

toggleSelectNumericFacetValue

Select (unselect) a numeric facet value if unselected (selected).

updateNumericFacetSortCriterion

Updates the sort criterion of a numeric facet.

Field Actions

nonEmptyArray

nonEmptyString

registerFieldsToInclude

History Actions

back

change

forward

logNavigateBackward

logNavigateForward

snapshot

Pagination Actions

nextPage

Updates the page to the next page.

numberValue

previousPage

Updates the page to the previous page.

registerNumberOfResults

Initializes the number of results. For more information, refer to {@link https://docs.coveo.com/en/1461/cloud-v2-developers/query-parameters#RestQueryParameters-numberOfResults}

Parameters:

  • number: The initial number of results.

registerPage

Sets the initial page by initializing the firstResult property. For more information on firstResult, refer to {@link https://docs.coveo.com/en/1461/cloud-v2-developers/query-parameters#RestQueryParameters-firstResult}

Parameters:

  • number: The initial page number.

updateNumberOfResults

Updates the number of results.

Parameters:

  • number: The updated number of results.

updatePage

Updates the page by setting the firstResult property.

Parameters:

  • number: The new page number.

logPageNext

Log pager next

logPageNumber

Log page number

logPagePrevious

Log pager previous

logPagerResize

Log pager resize

Pipeline Actions

setPipeline

Query Actions

updateQuery

Update the basic query expression.

Parameters:

  • q: The new basic query expression (e.g., acme tornado seeds).

logSearchboxSubmit

Log searchbox submit

Query Set Actions

registerQuerySetQuery

Register a query in the query set.

Parameters:

  • id: The unique identifier of the target query.

  • query: The initial basic query expression.

updateQuerySetQuery

Update a query in the query set.

Parameters:

  • id: The unique identifier of the target query.

  • query: The updated basic query expression.

Query Suggest Actions

clearQuerySuggest

Clear the current partial basic query expression and list of query suggestions in a specific query suggest entity.

Parameters:

  • id: The unique identifier of the target query suggest entity (e.g., b953ab2e-022b-4de4-903f-68b2c0682942).

clearQuerySuggestCompletions

Clear the list of query suggestions in a specific query suggest entity.

Parameters:

  • id: The unique identifier of the target query suggest entity (e.g., b953ab2e-022b-4de4-903f-68b2c0682942).

fetchQuerySuggestions

Fetch a list of query suggestions for a specific query suggest entity according to the current headless state.

Parameters:

  • id: The unique identifier of the target query suggest entity (e.g., b953ab2e-022b-4de4-903f-68b2c0682942).

registerQuerySuggest

Register a new query suggest entity to the headless state to enable the Coveo ML query suggestions feature.

Parameters:

  • id: A unique identifier for the new query suggest entity (e.g., b953ab2e-022b-4de4-903f-68b2c0682942).

  • q: The partial basic query expression for which to request query suggestions (e.g., cov).

  • count: The number of query suggestions to request from Coveo ML (e.g., 3). Default: 5.

selectQuerySuggestion

Select a suggestion provided through a specific query suggest entity.

Parameters:

  • id: The unique identifier of the target query suggest entity (e.g., b953ab2e-022b-4de4-903f-68b2c0682942).

  • expression: The selected query suggestion (e.g., coveo).

unregisterQuerySuggest

Unregister an existing query suggest entity from the headless state.

Parameters:

  • id: The unique identifier of the query suggest entity to unregister (e.g., b953ab2e-022b-4de4-903f-68b2c0682942).

Redirection Actions

checkForRedirection

Preprocess the query for the current headless state, and updates the redirection URL if a redirect trigger was fired in the query pipeline.

logTriggerRedirect

Log trigger redirection

Result Analytics Actions

logDocumentOpen

Search Actions

executeSearch

Executes a search query.

Search Hub Actions

setSearchHub

Sort Criteria Actions

registerSortCriterion

Initializes the sortCritera. For more information, refer to {@link https://docs.coveo.com/en/1461/cloud-v2-developers/query-parameters#RestQueryParameters-sortCriteria}

Parameters:

  • string: The initial sort criterion.

updateSortCriterion

Updates the sortCritera to the passed criterion.

Parameters:

  • string: The updated sort criterion.

logResultsSort

Log results sort

Recommended Articles