November Happy Hour will be moved to Thursday December 5th.

Most frequent searches

Vote:
 

Hi,

In EPiserver Statistics UI we have a Tab for Most Frequent Searches. How can I get those most frequest searches in my code?

I need to know Search phrase and number of queries.

Regards
/K

#122664
Jun 09, 2015 16:41
Vote:
 

I can't find any whay to do it, saidly.
I will add a feature request on it

#122673
Jun 10, 2015 8:39
Vote:
 

Theoratically it can be done as, but I am not sure. On top of that, not familiar with Elastic Search syntax also :(

string q = "ElasticSearchQueryToGetTheseDetails";
IQueriedSearch<ISearchContent> queriedSearch = SearchClient.Instance.UnifiedSearch(Language.None)
.For(q);
UnifiedSearchResults result = (queriedSearch).Take(20).GetResult(null, true);

Regards
Khurram

#122675
Jun 10, 2015 9:18
Vote:
 

+1, But what if i need that before version x.y.z :)
/K

#122681
Jun 10, 2015 9:52
Vote:
 

There is no way to do this through the API right now. Unified search can not be used since this statistics uses its own index. I think this might be added since it does seem to be a useful feature. For now, this can be achived using a rest request to the stats index like 

EPiServer/Find/proxy/_stats/query/top?from=2015-06-09T12%3A00%3A00Z&to=2015-06-10T12%3A00%3A00Z&interval=hour&size=25

which is what the Find UI does. The response would look like

{"status":"ok","total":1,"hits":[{"query":"alloy","count":1}]}

/Viktor

#122690
Edited, Jun 10, 2015 13:37
Vote:
 

Thanks Viktor, that was great to know!

#122693
Jun 10, 2015 13:53
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.