Sitecore and Coveo Integration

Nov 09, 2011
Juan Arias

Coveo can really help improve your search results in your sitecore website, but it will require some configuration and personalization in order to have custom results of your site.

It will be necessary to install the Sitecore Connector that you can get from coveo’s website and basically follow the instructions you have in this document: Coveo Sitecore Connector

With the basic Coveo configuration you will be able to index your pages, but you probably also want to search specific Sitecore fields and give the user the option to do an advanced search. You will need to create a mapping file and include it in Coveo’s source configuration, as you can see in the picture:

The file myMapping.xml can contain a text like this:

<?xml version="1.0" encoding="utf-8" ?>
<
Sitecore>
   <CommonMappings>
     <Fields>
       <RBContentType>HTML / Web Page</RBContentType>
       <MyDateCreated>%[_CESSCCreated]</MyDateCreated>
     </Fields>
   </CommonMappings>
   <!--MyFirst Template-->
   <Mapping template="{E426AF8B-AAAA-BBBB-CC36-A3FFCE3C23AB}">
     <Fields>
        <MyFirstField>%[SitecoreFieldOne]</MyFirstField>
        <MySecondField>%[SitecoreFieldTwo]</MySecondField>
     </Fields>
   </Mapping>
   <!--MySecond Template-->
   <Mapping template="{E587015E-FFFF-4FB5-B83F-8B886C928A2A}">
     <Fields>
        <MyCustomField>%[SitecoreCustomField]</MyCustomField>
    </Fields>
   </Mapping>
   <!-- Ignore a Folder Template-->
   <Ignore template="{7685EAD2-CCCC-4F50-8785-E6948E96CB40}"></Ignore>
   <!-- Ignore another Template-->
   <Ignore template="{C90C442F-DDDD-41B7-9AC1-F15CC9B53FC8}"></Ignore>
 </Sitecore>

This file contains many sections; you can find the complete explanation of each in the Sitecore Connector installation instructions, but the most important is that you have to include the sitecore fields you want to index, for example “SitecoreFieldOne“ will be mapped to coveo field “MySecondField”. You can also map to some metadata elements that the Sitecore Conector adds:

_CESSCServerBaseUrl

_CESSCContentPath

_CESSCFullPath

_CESSCID

_CESSCIsContentItem

_CESSCIsFullyQualified

_CESSCIsMasterPart

_CESSCIsMediaItem

_CESSCKey

_CESSCLongID

_CESSCMediaPath

_CESSCMediaUrl

_CESSCChildrenIDs

_CESSCParentID

_CESSCParentPath

_CESSCPath (sysuri)

_CESSCTemplateID

_CESSCTemplateName

_CESSCDisplayName

_CESSCFriendlyUrl

_CESSCHasLayout

_CESSCLanguageName

_CESSCLanguages

_CESSCLanguageTitle

_CESSCLocker

_CESSCName

_CESSCUri

_CESSCVersion

_CESSCWorkflowstate

_CESSCCreated (sysaddeddate)

_CESSCCreatedBy

_CESSCRevision

_CESSCUpdated (sysdate)

_CESSCUpdatedBy (sysauthorloginname)

 

After you have the mapping file ready, it is time to add the custom fields to Coveo, this is done by going to your Coveo administration page, and click on Add:

Give it a name and save it. Then click on add to include your fields to your new field set:

Add the required field information and save:

After you have added all the fields, go to your Coveo Source, click on Fields, and select your field set and click Apply Changes:

After this, click on Rebuild. The process will take some time depending on the size of your Sitecore site, when it has finished, you can see the values indexed by clicking on Indexed Documents:

In the Folder Content section, navigate to your item:

You will see your values for this item indexed in Coveo in the Fields section:

You can also test your new fields by going to the Coveo’s default search interface:

Post created by Juan Arias, Oshyn Inc. employee. Some information gathered from Coveo website.