Gravatar for hernandez@rdacorp.com

Question by benaldo, Jan 1, 2017 12:38 PM

Query Suggestions on search page with global search box

I'm having some difficulty getting query suggestions to work on the search page with a global searchbox. I'm initializing the box like so:

    //code above determines we are not on search page
    var searchOptionsForSearchBox = {
        externalComponents: [document.getElementById('<%= Model.SearchboxId %>')]
    };
    CoveoForSitecore.componentsOptions = Coveo.$.extend({}, CoveoForSitecore.componentsOptions, searchOptionsForSearchBox);
    Coveo.$('#search').on('afterInitialization', function () {
        setSearchBoxPlaceholderText();
    });

The search box seems to be wired up correctly; searches will fire on the search page without a full postback. However, I'm not seeing any XHR requests fired as I type, the same way I do on other pages - where the box is initialized as follows:

    if (typeof(CoveoForSitecore) !== 'undefined') {
        CoveoForSitecore.componentsOptions = <%= Model.GetJavaScriptInitializationOptions() %>;
        searchbox.coveoForSitecore('initSearchbox',
                                    CoveoForSitecore.componentsOptions);
    } else {
        searchbox.coveo('initSearchbox',
                        '<%= Model.GetSearchPageUrl() %>');
    }

I also have suggestions enabled (with machine learning advanced unchecked as we don't use cloud) on the coveo items in sitecore.

Any ideas as to what would cause the suggestions request to not fire?

0 Reply
Ask a question