Gravatar for steve.anderson@rbaconsulting.com

Question by Steve Anderson, Oct 20, 2015 12:53 PM

Hide Facet yet still allow for querying

Hello

I have a search results page with a number of facets on it (Coveo Facet View MVC Controls). I also have an Coveo Search View control, and am using the omnibox. Initial queries are submitted from a query string (form post) to a page called 'search' as so:

/search#q=&f:@searchscope=[Products]

This works fine, as long as there is a facet control on the page for the @searchscope field, and none of the query string syntax shows up in the omnibox. When I remove the facet view for the @searchscope field, all results are returned, as there is no such facet any longer. If I revise the query string to look like:

/search#q=%40searchscope%3D%22Products%22

This yields the correct results, but also places the "@searchscope="Products"" in the omnibox.

Is there any way to leave the facet on the page, but simply have it not displayed?

Thank You!

2 Replies
Gravatar for steve.anderson@rbaconsulting.com

Answer by Steve Anderson, Oct 20, 2015 8:34 PM

After a little more searching, I found the answer here:

Hide Facet - question 4472

Gravatar for slangevin@coveo.com

Comment by Simon, Oct 20, 2015 9:54 PM

Awesome! Good to know.

Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Oct 21, 2015 2:46 PM

A better way to achieve your end result would be to:

  1. Remove your @searchscope facet.
  2. Use the aq query parameter instead of the q parameter like this: /search#aq=%40searchscope%3D%22Products%22

The q parameter is for the "basic query expression". That's the one displayed in the search box of the search interface. The aq parameter stands for "advanced query expression". This is the expression used by the search interface to filter the results. There is also a cq parameter that is for "constant query expressions". Only query expressions that are fixed and won't change in time should be put in the cq parameter as those are cached by the search index engine and those caches are refreshed every time it applies an indexing transaction.

I hope this helps you to achieve a clean search page implementation.

Jeff

Ask a question