Gravatar for shirazi@rdacorp.com

Question by aga, Sep 22, 2015 5:10 PM

Hide Facet

Hi,

I'm looking for a way to hide a facet on the server-side at runtime/dynamically. Can this be done?

Thanks

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Sep 23, 2015 10:19 AM

Hi,

Can you specify which search interface framework you are using please?

  • Coveo JavaScript Search Framework (JS UI)
  • Coveo .Net Front-End (.Net UI)

Also, are you using Coveo for Sitecore?

Thanks,

Jeff

Gravatar for shirazi@rdacorp.com

Comment by aga, Sep 23, 2015 12:16 PM

I'm using Coveo for Sitecore. I know i can get it done using js using JSUI but i want it done on the server side preferably in a pipeline.

2 Replies
Gravatar for slangevin@coveo.com

Answer by Simon, Sep 23, 2015 10:18 AM

Hi,

I am not entirely sure what you want to do but Facets are, like everything else, an element of the DOM.

Using the Javascript interface, if you inspect the elements of the page, you will see that facets are all under the facetColumn id and they are all part of the CoveoFacet class. They all have their own id so simply hiding that ID using jQuery .hide() or style.display = 'none' is JavaScipt.

Let me know how it goes. Cheers,
Simon

Gravatar for shirazi@rdacorp.com

Comment by aga, Sep 23, 2015 12:14 PM

Simon, i know i can do this on the client side, but I want it done on the server.

Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Sep 23, 2015 12:22 PM

If you bought the Enterprise edition of Coveo for Sitecore, you can use the layout personalization feature of Sitecore on the Coveo for Sitecore Facet components to define conditions where your facet should be hidden (see Personalizing Coveo Components).

Gravatar for shirazi@rdacorp.com

Comment by aga, Sep 23, 2015 12:25 PM

That is an interesting approach and I'll need to think about that as we arent using Personalization. Do you think we can do it any other way?

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Sep 23, 2015 12:32 PM

You may code your own facet component based on the Coveo one and add some logic to the OnPreRender or Render methods.

Or you can wrap the facet markup with a server control similar to Coveo's coveoui:WhenConfigured control to do your custom logic.

In all the cases, make sure to not modify the original files installed by Coveo for Sitecore and duplicate the files you want to customize and their related sublayouts/views.

Ask a question