Gravatar for ravigupta020287@gmail.com

Question by Ravi, May 24, 2018 10:28 AM

Most searched term component

I have a requirement to show most frequently searched term in my search omnibox, is there any way to render the most searched term in coveoUI?

Using Enterprise Cloud - Cloud

Sitecore version Sitecore.NET 8.2 (rev. 161221)

Thanks!

2 Replies
Gravatar for hsantos@coveo.com

Answer by Hugo Santos, May 28, 2018 8:34 PM

Hi @Ravi,

The answer to this question really depends on your needs.

If all you want is to show a few suggestions on your omnibox when the user is typing a query, then you just need to enable the query suggestion feature provided by our search interface (https://docs.coveo.com/en/873/coveo-for-sitecore-v4/provide-query-suggestions) as mentioned by @François Lachance-Guillemette.

However, if for a given reason you really need to fetch all this data manually to front it in a different fashion other than our omnibox, I’d suggest you to take a look on the Coveo SearchAPI querySuggest call instead of trying to call directly the Usage Analytics platform (https://developers.coveo.com/display/public/SearchREST/Getting+Query+Suggestions). It is way simpler and user friendly since it was conceived for this purpose.

All that said, if you still want to fetch this information from the Coveo Usage Analytics platform you should check those links:

  • https://answers.coveo.com/questions/7316/trendingmost-popular-search-results.html
  • https://platform.cloud.coveo.com/docs?api=UsageAnalyticsRead#!/Statistics32API324532Version3215/get_v15_stats_trends
  • https://platform.cloud.coveo.com/docs?api=UsageAnalyticsRead#!/Statistics32API324532Version3215/get_v15_stats_topQueries (this is simpler than the previous one)
Gravatar for ravigupta020287@gmail.com

Comment by Ravi, May 29, 2018 10:30 AM

We need to show the 5 trending keywords to the user not the query suggestion, it can be used as separate component that can be used in any part of a page.Is there any better way to show these trending keywords apart from using API call? If i am using usage analytics API to authorize the calls is it correct to use api key generated at coveo cloud platform for authentication of the API calls or is there any other way to authenticate it?

Gravatar for ravigupta020287@gmail.com

Comment by Ravi, May 29, 2018 11:10 AM

We need to show the 5 trending keywords to the user not the query suggestion, it can be used as separate component that can be used in any part of a page.Is there any better way to show these trending keywords apart from using API call? If i am using usage analytics API to authorize the calls is it correct to use api key generated at coveo cloud platform for authentication of the API calls or is there any other way to authenticate it?

Gravatar for hsantos@coveo.com

Comment by Hugo Santos, May 29, 2018 2:48 PM

Hi @Ravi,

So you really want a completely separated component which is able to show the 5 most searched keywords.

Coveo provides the API to fetch this information but you will have to develop the interface yourself since there is not something like that in the product currently.

My bet is that you will be fine using the following call, is is really simple:

https://platform.cloud.coveo.com/docs?api=UsageAnalyticsRead#!/Statistics32API324532Version3215/get_v15_stats_topQueries

If your previously generated API key has the right access to use this kind of service you should be able to use them without any issue.

If for a given reason that's not the case please let us know and we will help you as well.

Gravatar for flguillemette@coveo.com

Answer by François Lachance-Guillemette, May 25, 2018 1:08 PM

The "most frequently searched term" from the Omnibox is called "Query Suggestions".

If you check in your network tab when you execute a query, you can see a call to the `/querySuggest` endpoint which returns suggestions.

There is no component OOTB that fronts this elsewhere in the page than in the omnibox, but it would be possible to call this endpoint and show the values.

Gravatar for ravigupta020287@gmail.com

Comment by Ravi, May 26, 2018 6:57 AM

We are trying to get the data from coveo usage analytics like trending keywords using API call

https://usageanalytics.coveo.com/rest/v15/stats/trends

how do we invoke and authorize this to get the data that we need? is there any best practice if i have consume these data for custom component?

Ask a question