Take this example: you have multiple sub-domains hosted in your Sitecore site, and each one has its own node under Content and its own Home item. You also have various external sites not hosted in Sitecore as completely separate sites. You’re building a search page with Coveo and want to develop a basic facet to list all of your internal sub-domains and external sites so that the end-users can filter pages and content by site. How would one do this? In this blog post, I will explain. Disclaimer: When I did this, I was working with Coveo for Sitecore v4.1 – Hive Framework, so if your version is much different, it’s possible not everything in this post will be accurate. Additionally, please note that the XML/HTML code snippets in this blog post will have the greater than/less than symbols stripped out because WordPress can’t handle those.
Create a Coveo Field for Your Facet
Every new facet you create will need its own field, so let’s create one. This is going to be a string, single-value field representing the name of a particular site (i.e. “Store” or “Marketing”, etc). In your
Coveo.SearchProvider.Custom.config file, add a new field entry in the
fieldMap/fieldNames node. In my case, my field’s name was
aopaSiteName, so that naming convention will be used in other parts of this post as well. Your field entry should look something like this:
fieldType fieldName="aopaSiteName" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" isExternal="true" isFacet="true" /
Note that the field definition has
isExternal="true" – this specifies that the field is not a normal Coveo for Sitecore field, so the field name won’t need to be converted. So if you put
isExternal="false", your field name will become something like
fmyfield99999 instead of just
myfield. I suggest you keep this setting true to make development easier. Then,
isFacet=true is needed so that this field can be used in a facet.