Gravatar for

Question by krishna, Sep 25, 2015 6:16 PM

State Returning Text With Extra Characters After Package Upgrade


We have the following code - var expr = $('.CoveoSearchInterface').coveo('state', 'q');

With new package upgrade the search box text is returned with extra characters. For e.g. if we enter the search text as 'salesforce' above code is returning '<@- salesforce -@>'. The above code used to work fine before the package was upgraded to 1.901.4. Is it something to do with the package or we need to parse it.

Thanks, Krishna

1 Reply
Gravatar for

Answer by Martin Laporte, Sep 28, 2015 3:34 AM

The <@- marker is injected in the query when you disable query syntax through the data-enable-query-syntax=false attribute on the query box. But this value should not end up in the state (I tried it). Is there any custom code on your search page that might be interfering? Also, what version are you running?

Gravatar for

Comment by krishna, Sep 28, 2015 6:07 PM

You are correct, the state is working fine. After debugging more, I found the problem is with the The coved-more link is build using the and it is returning a value of the search text with <@- marker. We used to run on the 1.8* version and now we upgraded to 1.901.4 version.

Gravatar for

Comment by Martin Laporte, Sep 29, 2015 2:35 AM

Well it's normal that .build() should return the markers, as this method is used to build the query that will be sent to the backend. Could you just grab the state value instead?

Gravatar for

Comment by krishna, Sep 29, 2015 1:04 PM

The URL is built inside the managed package component 'CoveoPanel'. In version 1.860.1 code was:

var q = _this.dom.coveo('state', 'q');
 _this.moreLink.attr('href', baseHref + '&q=' + encodeURIComponent(q) + '&hq=' + encodeURIComponent(hq));

It is updated to use the .build() in the latest version. Should we request Coveo to update this logic?

Gravatar for

Comment by Martin Laporte, Sep 30, 2015 1:04 PM

Oh. From the look of it that would be a bug, yes. If you report this to support it'll be adressed.

Gravatar for

Comment by krishna, Sep 30, 2015 5:06 PM

Thanks you!

Ask a question