Gravatar for dsoriano@littelfuse.com

Question by Dean, Aug 30, 2016 3:40 AM

Coveo Facet changes

Hi

I noticed after moving to CFS 1312 from CFS 1084 that the Coveo facet had some changes in the URL anchors it generates. I don;t think I read about this in the upgrade guides online Before we had the pattern below:

CFS 1084

  • @f<####>=[]

CFS 1312

  • @f<####>sublcoveofacets<#>=[]

I noticed that there is an added "sublcoveofacets<#>" in between now. Is there a configuration we can change to keep the behavior before i.e. without the added text above?

Thanks

1 Reply
Gravatar for sbelzile@coveo.com

Answer by Sébastien Belzile, Aug 30, 2016 8:04 AM

No, there is no way to keep the old behavior, but there is a way to easily modify the anchors.

Most Coveo components have a property called Unique ID. This property is used as HTML ID as well as URL anchors.

You could set the Unique ID property of your facets to the value you previously had with CFSC 1084, or to something more user friendly.

Gravatar for dsoriano@littelfuse.com

Comment by Dean, Sep 1, 2016 1:19 AM

Just a follow-up, we have a routine that assembles the anchor url with the corresponding selected facet values from code so that we can redirect to the Coveo search page, before it was easy and we just used something like below

string.Format("&f:{0}=[{1}]", SitecoreUtilities.ToCoveoFieldName(fieldname), somevalue)

But now, given that there is a Unique Id now per facet, do we have an easy way of using that reliably in code?

Thanks

Gravatar for sbelzile@coveo.com

Comment by Sébastien Belzile, Sep 1, 2016 8:38 AM

Not sure I understand what you are trying to do. The facets selected values are persisted for the time of your user session?

Gravatar for dsoriano@littelfuse.com

Comment by Dean, Sep 1, 2016 12:01 PM

@sbelzile,

Basically, we have a page (not Coveo layout) where we let the users select from a set of facet values (think cascading drop downs) and at the click of a button, we take those selected values and assemble the search URL including the Coveo anchors format and do a redirect to the search page using that assembled url. My problem is, at runtime, I have no idea what the value is of the particular facet so I don't know what to put in the "sublcoveofacets<#>" part.

Thanks

Gravatar for sbelzile@coveo.com

Comment by Sébastien Belzile, Sep 1, 2016 12:07 PM

Well, if you set the unique id of the facet components, then you know what should be put in the URL.

For example: you have a facet with uniqueId "category", then the query parameter will be "category". You don't even have to perform operations on your strings depending on the context, it's a 1:1 mapping. i.e no more SitecoreUtilities.ToCoveoFieldName(fieldname).

Ask a question