Searchbox Lightning Component

DEPRECATED - Non-Locker Compliant

The Searchbox Lightning component allows you to change the search box in your Lightning community.

It takes care of wrapping and including the correct scripts and different resource references needed to do so.

For a tutorial on how to implement a custom search box component, see Creating a Custom Standalone Searchbox for Your Lightning Community.

Usage

Simply reference it in your Lightning component as you would for any other Aura component, using the namespace prefix of the Coveo package.

<aura:component implements='forceCommunity:searchInterface'>
  <CoveoV2:Searchbox/>
</aura:component>

Resources Included With This Component

This component includes the Coveo JavaScript Search Framework, the jQuery (latest 3.x.x version) and Underscore.js (latest 1.x.x version) libraries, and the Coveo for Salesforce specific assets.

Aura Event

This component offers the following Aura event:

GetSearchToken

Fired when the search token has been fetched (see Generating a Custom Search Token for Lightning Components).

Options

This components offers the following options:

name

The name of the Visualforce component that should act as your search interface.

Depending on the Lightning component you are using, this could either be a search or a case creation Visualforce component.

Default value is communityCoveo.

searchHub

The name of the searchHub to be sent to Coveo Usage Analytics (Coveo UA).

This option should have the same value as name.

Default value is communityCoveo.

searchPageName

The name of the community page your Coveo Search component is on.

This option does not have a default value.

To make it work, you need to enter the following value:

  • With Salesforce before Winter 18: search/all/home/%40uri

  • With Salesforce Winter 18 and up (with up-to-date community): global-search/%40uri

placeholder

The placeholder text to put in the searchbox when no query is typed.

This option does not have a default value.

enableQuerySuggestAddon

Specifies whether to enable Coveo Machine Learning (Coveo ML) for query suggestions (see Omnibox - enableQuerySuggestAddon).

Default value is true.

triggerQueryOnClear

Specifies whether to trigger a query when the search box is cleared (see Querybox - triggerQueryOnClear).

Default value is true.

enableQuerySyntax

Specifies whether special characters should be interpreted as the Coveo Query Syntax (see Querybox - enableQuerySyntax).

Default value is false.

enableFieldAddon

Specifies whether field names should be suggested (see Omnibox - enableFieldAddon).

Default value is false.

enableQueryExtensionAddon

Specifies whether to complete query extensions (see Omnibox - enableQueryExtensionAddon).

Default value is false.

customTokenGeneration

Specifies whether to create a custom token instead of relying on the default one (see Generating a Custom Search Token for Lightning Components).

Default value is false.

debug

Whether to load the non-minified versions of the different resources.

Setting this option to true enables more logging, but can be slower overall. Only enable this when developing or debugging components.

Default value is false.

Recommended Articles