Gravatar for vbernard@coveo.com

Question by Vincent, Apr 19, 2017 9:17 PM

Triggering search with Javascript

The issue we’re having is integrating Google maps into Coveo search – we need to re-trigger the search based on map zoom/pan. I’m trying to add the lat/long coordinates to the query but the search results don’t refresh. I’m sure this is an easy fix but I’m stumped.

2 Replies
Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Apr 19, 2017 9:26 PM

Have you looked at the Coveo JavaScript Search Framework tutorial?

It is fairly easy to trigger a query:

Coveo.executeQuery(Your_CoveoSearchInterface_DOM_Element);
Gravatar for beckjohnson@gmail.com

Comment by beckjohnson, Apr 19, 2017 11:28 PM

Yes, I see the request in the network tab, and I see the warning "A search was triggered, but no analytics event was logged", but the search results don't refresh.

Gravatar for beckjohnson@gmail.com

Answer by beckjohnson, Apr 28, 2017 11:26 PM

I was able to trigger a search with a different syntax:

Coveo.$('#Your_CoveoSearchInterface_DOM_Element').coveo(Coveo.QueryController).executeQuery();
Ask a question