THIS IS ARCHIVED DOCUMENTATION

Using External Content in Sitecore Facets

This page assumes that you’ve already indexed an external source in the Coveo Enterprise Search (CES) Administration Tool, and have enabled that source as searchable in your Sitecore instance. For more information, on how to do this, see Configuring an External Source and Enabling the External Source in Sitecore.

This page assumes that you’ve already indexed an external source in the Coveo Platform, and have enabled that source as searchable in your Sitecore instance. For more information on how to do this, see Configuring an External Source and Enabling the External Source in Sitecore.

Now that you’ve indexed external content into Sitecore, you probably want to filter it using facets too. For this example, you’ll want to filter items by author.

  1. In the Experience Editor, add a Coveo Facet.

    1. Title: Enter Author.

    2. Field: Select Author.

  2. Click OK to add the facet.

You’ll notice that only your Sitecore items are shown in the facet. That’s because your external content doesn’t contain the Author facet.

Sitecore already has a facet called Author, which you can find under Sitecore > System > Settings > Buckets > Facets.

If you click the Author facet, under Field Name, you can see that it’s created from the field parsedcreatedby. This is the field that you need to add to your external sources to have them appear in your Author facet.

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 CES Administration Console, go to Content > Index Browser.

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

  3. Under the Fields tab, validate that the field parsedcreatedby doesn’t exist.

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

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

  3. Under Fields, verify that there are no field called parsedcreatedby.

Step 2: Adding the Field Name to Your External Content

You now need to add the field parsedcreatedby to your external content, and set it to the author of your external source.

  1. Under Index > Sources and Collections, click your external source.

  2. In the menu on the left, select Fields.

  3. Click Edit, bringing you to the Configuration > Fields > Custom Fields page of your external source.

  4. Click Add, and enter the following parameters:

    1. Name: Enter a name for your custom field. For this example, use parsedcreatedby.

    2. Type: Keep it at String.

    3. Metadata Name: Enter the name of your field. For this example, use parsedcreatedby.

    4. Default Value: Enter the value given to your field. For this example, use Sitecore website.

    5. Option: Make sure Allow faceted search on this field is checked.

    6. Click Apply Changes.

  5. Rebuild your source. Under Index > Sources and Collections, select your source, and choose Rebuild.

  6. After the source has finished rebuilding, verify that your field was applied to your source.

    1. Under Content > Index Browser, choose one of your items, and click Details.

    2. Choose the Fields tab. Your new field should appear.

  1. In the Administration Console, select Content > Sources.

  2. Select your source, and then click Mappings in the Action bar.

  3. Click Add Mapping, and format your mapping this way:

    1. Apply to: Choose All item types.

    2. Field name: Choose parsedcreatedby.

    3. Extraction method: Choose Literal string.

    4. Content: Type in the name of the author of your external content.

  4. Click Apply, and then on Save and Rebuild.

  5. After the source has finished rebuilding, verify that your field was applied to your source.

    1. Go to the Content Browser.

    2. Access your item properties by clicking Properties. When searching for your field, you should now get a result with the right value.

Step 3: Tell Sitecore to Consider the Field as a Facet

Now that you’ve added the field parsedcreatedby to your external items, you need to have it recognized in your Sitecore instance.

By default, Coveo for Sitecore hashes field names, adding an f before its name and up to five digits at the end, resulting in something similar to fadministrator69462. This is done to avoid field name collisions.

For this example, you want to avoid having your field name hashed. This is how to do it.

  1. Open your Coveo.SearchProvider.Custom.config file. It’s usually located under <SITECORE_INSTANCE_ROOT>\Website\App_Config\Include\Coveo.

  2. In the defaultIndexConfiguration element, add the following nodes. By configuring the field parsedcreatedby as external, you’re preventing it from being hashed.

Prior to Coveo for Sitecore (August 2018) release, use this configuration:
```xml
<fieldMap>
  <fieldNames>
    <fieldType fieldName="parsedcreatedby" isExternal="true" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
  </fieldNames>
</fieldMap>
```
Since Coveo for Sitecore (August 2018) release, use this configuration:
```xml
<fieldMap>
  <fieldNames>
    <fieldType fieldName="parsedcreatedby" isSourceSpecific="false" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
  </fieldNames>
</fieldMap>
```
  1. Save and close the file.

  2. Rebuild your Sitecore indexes.

  3. When you refresh your search page, validate that Sitecore website appears as an author in the Author facet.