Gravatar for mchemani@absolunet.com

Question by michaelchemani, Jan 21, 2015 9:28 AM

c.coveo is undefined

Hi,

I am new with Coveo and when I try to initialize it I got the foloowing error message : TypeError: c.coveo(…) is undefined.

I don't have any how to resolve this. Help would be much appreciated :).

Thank you.,

3 Replies
Gravatar for vseguin@coveo.com

Answer by Vincent Séguin, Jan 21, 2015 9:45 AM

Hi,

It would be nice to have an example the code you're trying to achieve to help troubleshoot :)

Gravatar for mchemani@absolunet.com

Answer by michaelchemani, Jan 21, 2015 9:47 AM

    $searchInterface
        .coveo('init', {
            SearchInterface : {
                enableHistory       : true,
                hideUntilFirstQuery : false,
                hiddenExpression:
                '(@syscollection==' + collection + ')' +
                '(@syssource==' + source + ')' +
                '(@syslanguage==' + sysLanguage + ')',
                excerptLength       : 300
            },
            ResultList: {
                resultTemplate: new Coveo.Ui.JsRenderTemplate(App.tmpl.coveo_result)
            },
            externalComponents      : [$searchBox]
        })
        .on('preprocessResults', function(e, data) {
            $noResults.hide();
            if(data.results.totalCount) {
                for (var i in data.results.results) {
                    var result          = data.results.results[i];
                    var splittedResult  = result.title.split('|');
                    result.title        = splittedResult[0];
                }
            } else {
                $noResults.find('a').attr('href', function(index, value) {
                    return value + '#q=' + data.query.q;
                });

                $noResults.show();
            }

        });

When I tried to log in preprocessResults, nothing is happening. It looks like I never go in this preprocess.

Gravatar for apare@coveo.com

Answer by Alexandre Paré, Jan 21, 2015 10:07 AM

This look like a double Jquery problem. In the js ui we add a Jquery add wrap it in coveo.$. what you need to do is :

var $searchInterface = coveo.$('#search');

Then the extension Coveo will be available on the jquery element and you will be allowed to catch Coveo event on those element.

Ask a question