Gravatar for acerunyan@gmail.com

Question by Arno, Feb 12, 2018 7:31 PM

How to change Facet Name

I'm trying to change the facet name using this.
https://developers.coveo.com/display/public/JsSearchV1/Normalizing+Facet+Value+Captions

but it does not work. What do I miss?

<div id="sourceFilter" data-field="@source"></div>
var sourceFacetValueCaption = {
    "oldName":"newName"
};
Coveo.init(root, {
    sourceFilter : {
       valueCaption : sourceFacetValueCaption
    }
});
Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Feb 12, 2018 8:17 PM

Hello Arno,

Are you trying to change the facet title or the name of the facet values inside the facet itself?

Also, do you have the `root` variable defined somewhere and do you have more than one call to `Coveo.init`?

Gravatar for tribloom@stanford.edu

Comment by mmccarthy, Apr 8, 2019 8:24 PM

I too am facing this issue. I am not seeing the facet values change when using the above referenced code. I do have a root variable:

var root = Coveo.$$(document).find('#search');

I also tried using Coveo.options:

Coveo.options(root, {
  sourceFilter : {
    valueCaption : sourceFacetValueCaption
  }
});

Any suggestions?

Thanks.

1 Reply
Gravatar for acerunyan@gmail.com

Answer by Arno, Feb 12, 2018 9:33 PM

sorry, it worked, I put the init to the very end of the code.

Ask a question