Gravatar for

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:


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?


1 Reply
Gravatar for

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 about it, but it's currently down…

Gravatar for

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

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


Gravatar for

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

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