Gravatar for paldrich@ascedia.com

Question by Paul Aldrich, Oct 20, 2017 6:31 PM

How to create a facet including sub-domains and external pages?

I need to create a Coveo for Sitecore search page facet that includes sub-domains of the current website (each represented by a node under sitecore/Content), and external pages. I know this is possible, because the http://search.coveo.com/ page has a Site facet that includes sub-domains of coveo.com, and external pages (e.g. the GitHub page). I've set up external sources for the three external pages I need to include using the Web connector.

I'm getting tripped up on the field aspect of setting up this facet. I know it is possible to set up external fields, or Sitecore fields that can also be external, but I'm not sure what that field would be and how it would get populated. Right now I'm using syssource, which only includes the content sources.

If you could provide a link to the documentation that accomplishes this task, that would be helpful; I did find this: https://developers.coveo.com/display/public/SitecoreV4/Using+External+Content+in+Sitecore+Facets, but that's also only on a content source level, so I don't think sub-domains would work in that example.

1 Reply
Gravatar for sbelzile@coveo.com

Answer by Sébastien Belzile, Oct 23, 2017 11:02 AM

There are many ways to achieve this:

  1. Since all your sites are represented by a node under `sitecore/Content`, you could create a computed field to map these paths to the name of a "site".
  2. Another computed field, but this time, you use the pipeline `coveoResolveItemSite` to resolve the site your item is in.

You will need to declare your field as `isExternal=true`, and `isFacet=true` in the field map of the Coveo configuration. The field has to be external so that it does not get translated into `fsitenameXXXXX` and needs to be facetable to actually be usable in a facet.

With your external sources, what to do depends on your configuration. If you have one web source per site, you can easily add a mapping that maps a constant "site name" to a field `sitename`. But before doing this, have a look at your documents. There may be an already usable `site` field that you could map instead of something static.

Next steps are pretty straightforward: the usual to add a facet. Add a facet item in your facet folder, and add a facet referencing that facet in your Coveo search page.

Edit: changed the word "field" for "site" in option 1.

Gravatar for paldrich@ascedia.com

Comment by Paul Aldrich, Oct 23, 2017 8:31 PM

Hi Sébastien,

I appreciate your response. Can you expand on what you mean by "map these paths to the name of a field" in option 1, possibly by providing some pseudo code? I am having trouble understanding what you're suggesting. What would the field return?

Overall, are you suggesting I make two facets, one for internal/one for external and combine them in some way?

-Paul

Ask a question