Gravatar for

Question by Ben, Mar 3, 2015 3:47 PM

Similar Feature to MondoSearch SearchNames

I am looking for a feature in Coveo for Sitecore which behaves in the same manner which the SearchNames feature for MondoSearch works. I would like to be able to tie search terms directly to a specific page. I have not yet run across a feature matching this in the Online Help. Is this feature already in place or, will you guide me towards the pipeline I should intercept to handle this? Thanks

2 Replies
Gravatar for

Answer by Jean-François L'Heureux, Mar 3, 2015 5:55 PM

Sorry for the confusion. The feature you describe is not an out of the box feature of Coveo for Sitecore but can be easily implemented by adding a few lines of code. We actually implemented it in our developer documentation portal with Confluence pages.

With the JS UI that is used by Coveo for Sitecore, it consists of using the OmniBoxResultList Component, provide a Coveo query to filter the desired documents in the data-query-override argument and implement a simple result template like this:

<!-- This element is already in the CoveoSearch.ascx file -->
<div class="CoveoSearchBox" data-activate-omnibox="<%= Model.ActivateOmniBox %>"
    <% if (Model.ActivateOmniBox) { %>
        data-omnibox-delay="<%= Model.SearchBoxSuggestionsDelay %>"
    <% } %>
    <% if (Model.IsSearchAsYouTypeActivated) { %>
        data-search-as-you-type-delay="<%= Model.SearchBoxSuggestionsDelay %>"
    <% } %>

<!-- This element should be added to the file to provide the suggestions. Here I show only items that have a layout. -->
<div class="CoveoOmniBoxResultList"
     data-query-override='<%= ToCoveoFieldName("HasLayout") %>=="1"'>
    <script class="result-template" type="text/x-underscore-template">
            <a class="CoveoResultLink">{{=title?highlight(title, titleHighlights):clickUri}}</a>
Gravatar for

Comment by Ben, Mar 18, 2015 9:34 AM

Thank you for this reply. I'm late to respond on this since I ended up speaking with Simon about the possible options to handle this, and wanted to see his feedback. One solution he gave is your approach. Another option given was to intercept the query building event and redirect from there.

His Example:

var routes = { 'home' : '' }

$("#search").on('buildingQuery', function(ev, args) { var query = $("#tonTextBoxID").val();

var route = routes[query] if(route){ window.location = route } });

Gravatar for

Comment by Jean-François L'Heureux, Mar 18, 2015 9:42 AM

This is a possibility but I think it have a bad usability.

  1. The users will be redirected automatically while they were trying to do a search by pressing Enter or clicking the search button. It's confusing.
  2. The users need to know by heart the exact names of the pages they are trying to reach to be redirected.

The OminBoxResultList component doesn't have those problems.

  1. It displays pages suggestions that contains the typed text.
  2. It doesn't redirect the users when they hit Enter or click the search button.
  3. It redirects the users only when they select one of the suggestion.
Gravatar for

Answer by Jean-François L'Heureux, Mar 3, 2015 4:08 PM

This feature is called "Top results" in Coveo terminology. You can learn about this feature here :

In Coveo for Sitecore, indexed item uris contains the item database, language and version. This does not work well with top results because when you have multiple versions of your Sitecore items and publish a new version to the web database, the old top result stop working and you need to manually edit the old one to edit its version.

We're currently planning an improved way to manage top results from the Sitecore CMS that will allow database/language/version independent top results.

Gravatar for

Comment by Ben, Mar 3, 2015 4:12 PM

From my understanding Top Results deal with ranking, and will show the item associated with the search term at the top of the result list. I'm looking for a way to navigate directly to the Top Result instead of just showing the item as highest ranked. Is that capability also available through Top Results?

Ask a question