Displaying External Content in a Sitecore Search Interface

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 Cloud offers a large array of connectors. These connectors and their deployment guides are listed under Available Connectors.

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

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

After having indexed your external source in the Coveo Platform, 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.

  5. Click OK.

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

Depending on the filtering you have set up (e.g., 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.

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 several 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.

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>.

  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>
    

    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.

    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:

  1. Fields in sources non-related to Sitecore.

  2. Coveo system fields.

When adding external fields on Sitecore items:

  1. Locate the fieldMap section of the Coveo.SearchProvider.Custom.config file (see Understanding 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 Cloud Administration Console, go to Content > Content Browser.

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

  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 Adding and Managing 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.

Recommended Articles