Gravatar for jennifer.palawasta@blackbaud.com

Question by Jennifer Palawasta, Jun 23, 2016 1:35 PM

How can I display a facet but have it marked as excluded by default

We are using Coveo for Salesforce JSUI v 0.9. We allow our internal users to search Archived SFDC articles and do not want to include the Archived content by default in search. Is there a way to adjust the Facet class to mark the Archived facet as excluded by default? Updating the URL to add the facet exclude element will require changes by our IT team, which I am trying to avoid.

Thanks in advance.

1 Reply
Gravatar for olamothe@coveo.com

Answer by olamothe, Jun 27, 2016 1:38 PM

Hi,

you can call a facet instance method using the jQuery extension :

$('#someSelectorThatTargetYourFacet').coveo().excludeValue('someValueThatShouldBeExcluded');

https://developers.coveo.com/display/JsSearchV1/Facet+Component#FacetComponent-excludeValue

You probably want to call this on the event afterInitialization. https://developers.coveo.com/display/JsSearchV1/Events#Events-afterInitialization

Gravatar for jennifer.palawasta@blackbaud.com

Comment by Jennifer Palawasta, Jun 27, 2016 3:28 PM

Thanks. I tried those steps and it just returns a blank search page or the page never loads and I am not sure what I am missing. Is there a facet div data element that I can use instead of the jQuery extension?

Gravatar for olamothe@coveo.com

Comment by olamothe, Jun 28, 2016 9:59 AM

A blank search page as in it does not load at all ?

This means you have either a javascript syntax error, or your jQuery selector is invalid (and does not target or return an actual facet).

The example I gave you is not a real selector btw, you need to plug in something that is actually in your HTML page.

Gravatar for jennifer.palawasta@blackbaud.com

Comment by Jennifer Palawasta, Jun 29, 2016 6:04 AM

Thanks for your help. I was able to implement code to exclude the facet on page load.

Ask a question