Gravatar for mark.angus@sitesystems.ca

Question by mark, Mar 11, 2015 12:40 PM

How to set data-allowed-values on facet dynamically.

Hi, I am using Coveo jsframeworks and would like to set the data-allowed-values dynamically based on the results returned. Some result items have more than one keyword attached to it and I would like to to just show one.

Thanks.

1 Reply
Gravatar for mlaporte@coveo.com

Answer by Martin Laporte, Mar 11, 2015 12:42 PM

Hmm I don't see how that would work --- the allowed values are used for retrieving facet information at the same time as the main query, so it's not really possible to have them depend on the results. But maybe I'm not getting what you're trying to do. Maybe if you reformulate?

Gravatar for mark.angus@sitesystems.ca

Comment by mark, Mar 11, 2015 12:44 PM

Hi, I appreciate the speedy reply. Is there any other way I can remove facet values after the query is completed? I figure I can just remove the unwanted values after the fact.

Thanks.

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Mar 11, 2015 12:58 PM

Well there is a way to play with the JSON results before they are processed, but I'm not sure it'd be a good idea. Facets are pretty complex and they might react strangely if the returned data doesn't fix their expectation. Can you be just a little more precise about how you'd decide if a value should be there or not?

Gravatar for mark.angus@sitesystems.ca

Comment by mark, Mar 11, 2015 3:02 PM

Hi, I have documents tagged with USA and North America At the moment, both USA and North America are listed in the facet. I want to remove USA from the facet leaving North America. I cannot re index the document removing USA. I have to deal with it on client side.

Thanks.

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Mar 12, 2015 11:33 AM

OK, but filtering it out with data-allowed-values should do the trick, no? This is not dependent on any variable factor…

Ask a question