Gravatar for nita.dambekodi-kamat@chamberlain.com

Question by Nita, Jul 11, 2018 10:30 PM

Filter condition include facet

I would like to filter by a facet when a user enters a certain keyword. Can I add this condition? I use the option for "Tab" and queries but not facet. My intention is to push the appropriate results.

Thanks

~Nita

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Jul 13, 2018 10:08 AM

I am not sure of which option you are talking about.

Is your use case only when someone enters keywords in the global search box on a non-search page and is being redirected to the search page?

Gravatar for nita.dambekodi-kamat@chamberlain.com

Comment by Nita, Jul 13, 2018 12:23 PM

When a user enter a keyword in global search box, I want to refine the results to a facet before it displays the results. Eg: If they query contains the word "dip switch", I would like to refine the results to "Garage Door Opener Accessories". Am I making sense now?

1 Reply
Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Jul 13, 2018 3:38 PM

Yes, that makes sense. If you already have JavaScript code to dynamically determine the tab (t URL attribute), then selecting facets should not be harder.

To find what to add to the URL for a facet selection, just go on your search page and select the desired facet item. You will see the URL will change and a new attribute will be added. This attribute is in the following format: `f:FacetNameOrField=[SelectedValuesSeparatedByCommas]`.

You just have to include this in the generated URL you use to redirect the user on the search page.

Ask a question