Gravatar for diego.moretto@xcentium.com

Question by Diego, Dec 17, 2014 10:35 AM

Coveo for sitecore: when adding the search keyword in the url how to retrieve it programatically?

Hi folks

I am using Coveo for sitecore and I am passing the search keywords through the url in this format:

http://host/Search-Results?#q=keyword

this query is working just fine but I need to get the "q" value from the url which doesn´t get passed on the object Request.Querystring nor on the Request.Url Since my sublayout inherits from Coveo.UI.CoveoSearch I tried getting the it from the Model object on the Page_PreRender event but I can´t seem to figure out where it gets stored. Does anyone know?

thanks

1 Reply
Gravatar for vseguin@coveo.com

Answer by Vincent Séguin, Dec 17, 2014 10:38 AM

Hi Diego,

You will need to access this 'q' parameter in JavaScript, by using what we call the 'State'. For instance : $('#search').coveo('state', 'q'); will give you access.

You can learn more on developers.coveo.com about it, but it's currently down…

Gravatar for diego.moretto@xcentium.com

Comment by Diego, Dec 17, 2014 10:44 AM

thanksVincent. But is it possible to access it in the server side?

thanks

Gravatar for vseguin@coveo.com

Comment by Vincent Séguin, Dec 17, 2014 10:50 AM

I'm unsure at the moment, but if you need it, we could enter a request for it.

Gravatar for diego.moretto@xcentium.com

Comment by Diego, Dec 17, 2014 10:55 AM

I will use the javascript approach for now if we don´t have it out of the box. Thanks Vincent!

Ask a question