Display External Content in a Search Interface

Warning
Legacy feature

This article pertains to the Coveo Hive framework which is now in maintenance mode.

Choose one of Coveo’s more modern, lightweight, and responsive libraries for any future search interface development. See the search interface Implementation guide for more details.

In addition to the items of your Sitecore Content Tree, a search interface built with Coveo for Sitecore components can return results coming from external systems.

Coveo offers a large array of connectors. These connectors and their deployment guides are listed under Connector Directory.

Once you have indexed your external content, you can include that content in a Coveo for Sitecore search interface.

Enabling the External Source in Sitecore

Note

This section assumes that you have already indexed an external source in Coveo (see Index External Content).

After having indexed your external source in Coveo, you need to enable it in Sitecore.

To enable the external source

  1. In the Sitecore Experience Editor, open your Coveo-powered search page (or search results page, if you’re redirecting searches from a global search box).

  2. Select the Coveo Search Interface component.

  3. In the floating toolbar, select Edit the rendering’s data source. It should be the leftmost option in the toolbar.

  4. In the External Content section, type the name of your external source.

    ExternalComponentExternalSourceName

    For multiple external sources, use a comma between your source names or list the sources on separate lines.

  5. Click OK.

  6. Save and publish your item. Your external source is now enabled.

Important

Depending on the filtering you have set up (for example, in the Coveo Search Interface component data source, in the Coveo Tab component data sources, or in a targeted Query Pipeline), documents from your external source may or may not appear in search results.

Example

In the Coveo Search Interface component data source, you have added a where the item has layout query filter rule. Because this rule pertains specifically to Sitecore items, external content items don’t meet that rule and are filtered out of the search results.

If all your external source documents are being filtered out of the search results unwantedly, you need to adjust your filtering rules (see Adjusting Filtering Rules to Include External Content in Search Results).

Adjusting Filtering Rules to Include External Content in Search Results

You might face a situation where your external content documents are unwantedly being filtered out of search results. You might also need to specify only one or a few external sources to be included in your search results. In both cases, you need to adjust your filtering to include a rule that uses the Coveo for Sitecore source field.

Example

Documents from an external source aren’t appearing in your search results when viewing a tab you labeled All Content, in your search page. You want your search results to include external source documents. You have an Enterprise Cloud Coveo for Sitecore license and have isolated the issue to be the where the item has layout query filter rule set in the All Content tab data source.

To display external source documents in your All Content tab search results

  1. In the Experience Editor, select the All Content tab component.

  2. In the floating toolbar of the selected component, select Edit the rendering’s data source. It should be the leftmost option in the toolbar.

  3. In the Query Filter section, under Filter expression rules, add the rule or where source field is equal to <NAME_OF_YOUR_EXTERNAL_SOURCE>.

    AddExternalSourceFilterRule
  4. Save your changes.

  5. Open your Coveo.SearchProvider.Custom.config file in a text editor.

  6. Locate the /fieldMap/fieldNames element.

  7. Within this element, add the following patch to change the isSourceSpecific attribute value on the source field name to false.

    <fieldType fieldName="source" >
      <patch:attribute name="isSourceSpecific" value="false" />
    </fieldType>
    Note

    If you don’t set the source field name to isSourceSpecific="false", the field name source you specified in your filtering rule is translated in the advanced query (aq) parameter of the search API call, as illustrated below.

    AQRuleSetEditorFieldNameWhenIsSourceSpecific

    Having the field name you specified translated this way makes your or filtering rule ineffective.

  8. Refresh your search page in the Experience Editor. When viewing the All Content tab, you should now have results coming from your external source.

  9. Publish your search page.

Adding External Fields

External fields are Coveo fields that aren’t found in Sitecore, such as:

  • Fields in sources non-related to Sitecore.

  • Coveo system fields.

When adding external fields on Sitecore items:

  1. Locate the fieldMap section of the Coveo.SearchProvider.Custom.config file (see About the Coveo Search Provider Configuration File).

  2. In the externalFields node, add the field name in that following format <field fieldName="myExternalField"/>.

  3. Save the file.

With this setting, you may now use these fields in Coveo for Sitecore facets, result templates, sort components, filtering/boosting rules.

Using External Content with Sitecore Facets

Coveo will index Sitecore fields based on your selection in the Fields section of the Coveo Command Center. These fields are extracted from the Sitecore templates, which means that if you plan to create facets to filter using these fields, it will only affect the Sitecore content where it was extracted.

This page explains the steps to populate a field on content external to the Sitecore instance where the field was extracted.

Step 1: Verify That the Field Doesn’t Already Exist in Your Sources

To prevent overwriting an existing field, you need to verify if it already exists in your sources.

  1. In the Coveo Administration Console, go to Content > Content Browser.

  2. Choose one of your external items, and click Properties.

    36176785
  3. Under Fields, verify that your Sitecore field doesn’t already exist on the item.

Step 2: Adding the Field Name to Your External Content

You now need to add the Sitecore field to your external content. This is done using source mapping explained in the Manage Source Mappings page.

Once the mapping is in place and the external source rebuilt, both Sitecore and external content should have a value for this field, allowing you to filter and boost on it.