Gravatar for

Question by mnrichardstokes, Oct 24, 2016 4:36 PM

Omnibox filtering and security

I have an omnibox that is using a CoveoTopFieldSuggestions and want to know if is possible to

a) apply my facet filtering to the omnibox (we have 8 facets) and we would like to limit the results to whatever is selected. b) apply windows security to filter out items where the user does not have access. The search results works with the security properly.

Here is a code snippet. I did not include all of the facets but the first one is included. We are using Coveo For Sitecore 3.0.

<div class="CoveoFacet" data-title="Business Unit" data-field="@@businessunitcomputed" data-number-of-values="15" data-id="@@businessunitcomputed" data-enable-collapse="True" data-enable-more-less="True" data-enable-settings="True" data-lookup-field="" data-sort-criteria="alphaAscending" data-is-multi-value-field="False" data-show-icon="True" data-computed-field="" data-computed-field-operation="" data-computed-field-format="" data-computed-field-caption="" data-include-in-breadcrumb="True" data-number-of-values-in-breadcrumb="5" data-include-in-omnibox="False" data-enable-facet-search="True" data-facet-number-of-values-in-facet-search="15" data-allow-toggling-operator="False" data-use-and="False" data-page-size="10" data-injection-depth="1000" data-available-sorts=""></div>

<div class="CoveoSearchBox" data-activate-omnibox="@Model.ActivateOmniBox" data-omnibox-delay="@Model.SearchBoxSuggestionsDelay" data-auto-focus="true" data-depends-on="@@businessunitcomputed"></div>
<div class="CoveoTopFieldSuggestions" data-field='@@titlecomputed'  data-header-title="Suggested Queries" data-number-of-suggestions="10"></div>
Gravatar for

Comment by ssartell, Oct 25, 2016 9:43 AM

Are you saying that you want the omnibox results to be filtered by the currently selected facet values? Typically I see search interfaces where you do an initial text search and then use facets to further limit your results set, but it sounds like you're using facets up front and then doing a text search. Is that correct?

Gravatar for

Comment by mnrichardstokes, Oct 25, 2016 10:28 AM

The site in question is our Intranet site and our search page often starts with the user's business unit selected, so they are initially only concerned about their business unit/department. That is why we would like to limit it to the selected facets. Also, we do not want to display the entries if they do not have any permissions.

1 Reply
Gravatar for

Answer by Simon, Dec 15, 2016 2:11 PM


For the filters, you have to use a query override:

queryOverride: @syssource=mysource

In this post I explained how to override the Omnibox, you can see the placement of my queryoverride in Coveo for Sitecore:

CoveoForSitecore.componentsOptions.FieldsSuggestions = { 
      omniboxSuggestionOptions: {
            //This queryOverride is optional, you can use it to filter the suggestions
            queryOverride: '@Model.ToCoveoFieldName("haslayout")=="1"',             

For the security, this is a bit harder, since this feature only provides query suggestions, which are not really based on security. I have a hard time to see how this could be done.

Ask a question