Gravatar for

Question by David Masters, Sep 13, 2016 10:42 AM

Top results not working

I have created a top results item in Sitecore for a particular search term, published that item, synced the top results via: Control Panel > Coveo Search > Actions > Synchronize Top Results and I've even rebuilt the index.

But the item I've chosen to appear at the top is not returning in the search results.

When I go to http://localhost:8081/Index/TopResults/TopResults.aspx everything looks OK, and I can see 2 entries for my search term; one for master and one for web, and I can see the sitecore ID for the item I want to appear at the top is correct.

What am I doing wrong?

Gravatar for

Comment by Luc Bergeron, Sep 14, 2016 8:40 AM


The top result configuration seems to be correct. One tricky thing with top results though is that it matches the whole user query, not just query terms.

Let's say a top result is configured to match the query events. Obviously the top result will show up when a user searches for events. On the other hand, searching for upcoming events will not return the top result.

Let me know how it goes

Gravatar for

Comment by David Masters, Sep 14, 2016 10:10 AM


Yeah, I'm only searching for the exact term - just a single word..


Gravatar for

Comment by Luc Bergeron, Sep 14, 2016 11:27 AM

Did you try to create a top result manually from the Admin Tool and see if it works? See

Did you try the same query via the Coveo Index Browser (http://localhost:8081 > Content > Index Browser)? If it works in the Index Browser but not from the search page, then maybe the query is modified by some custom code.

Coveo for Sitecore resolves the complete URI of the top result. Maybe the URI is wrong for some reason. Did you verify that the URI set in CES is correct? To validate:

  1. Locate the expected document using the Index Browser.
  2. Copy the URI in green just under the document title
  3. Edit the top result and verify if the URIs are the same. The only difference should be the /version/x that is getting replaced by a wildcard *.

I hope this helps

Gravatar for

Comment by David Masters, Sep 15, 2016 7:33 AM

I have run the same query via the Index Browser and it works correctly - The page specified appears twice, once for web and once for master. But I don't believe we have any custom code involved in the search via the site? If we did, where would this be defined? (Apologies I'm new to Coveo)

Also, I the URI returned in the top result is the same as the URI for when I search directly for that item.

Gravatar for

Comment by Luc Bergeron, Sep 19, 2016 10:56 AM

From what I understand the top result itself is working, so I guess the query might be altered somehow. Here is a simple test you can do to find out if the query is being altered before it is sent to the search index.

  1. From the Sitecore search page, perform a query using the top result keyword.
  2. Open the CES query logs (http://localhost:8081 > Logs > Queries).
  3. Click the View Log link to see the queries performed on the search index.
  4. Look at the Query column. Your will see whether your query was modified or not.

If the query is correct, check the user that was used to perform the query. Maybe the user that performs the query simply cannot access the top result document.

If your site uses the search page templates provided by Coveo, then customizations are done in the Sitecore renderings by handling custom JavaScript events. If the search page is using the LINQ API, then you should see with the site implementor.

I hope this helps

Gravatar for

Comment by David Masters, Dec 2, 2016 5:46 AM

I've only just managed to get back onto this issue.

Thanks - that information was very useful. I can see that the logs are showing that my keyword is duplicated three times for some reason. i.e. I have entered the word "repair" but the logs show "repair repair repair". I can also look at the query issued by he JS framework that the q parameter sent is (repair) (repair) (repair).

Do you have any idea why it would be repeated multiple times?

Thanks, Dave

Gravatar for

Comment by Luc Bergeron, Dec 2, 2016 8:40 AM

Thanks for the feedback. At least, having the query repair repair repair explains why the top result doesn't show up. Unfortunately I have no precise idea why the same query term would be repeated many times. My guess is that some custom JavaScript code is changing the query (most likely in the buildingQuery event).

I hope this helps

0 Reply
Ask a question