Hi Henrik =)
Use
var client = Client.CreateFromConfig();
var statisticsClient = client.Statistics();
StatisticsClient.GetTopQueries(topQueriesSize)
The method GetTopQueries does not exist anymore. Does anyone know where I can find it or do the same call in some other way?
Thanks
Hi Erik,
This was something we used to use internally for the old UI. We removed the method when we had no use for it. Obviously there is a need for it so I will make sure that it is included in the next release.
/Marcus
We are working on gett ing an accurate updated breaking change document up as soon as possible
Thanks Marcus
More questions:
1. Is the same index compatible with both version 7 and 8 of Find?
2. When calling var statisticsClient = client.Statistics();i get an error for our dev-index (I have activated stats on find.episerver.com)
Your index does not support statistics. Please contact support to have your account upgraded.
3. Is there any workaroud for this GetTopQueries right now? Can I access the index with your interal query and get the same result?
As a workaround for the GetTopQueries, you can use something like this:
public class StatsQueryTop
{
public string Query { get; set; }
public int Count { get; set; }
}
public class TopQueryCommand : Command
{
private string index;
private int size;
public TopQueryCommand(ICommandContext commandContext, string index, int size) : base(commandContext)
{
this.index = index;
this.size = size;
}
public StatisticsHitsResult<StatsQueryTop> Execute()
{
string url = GetUrl();
var request = CommandContext.RequestFactory.CreateRequest(url, HttpVerbs.Get, ExplicitRequestTimeout);
return GetResponse<StatisticsHitsResult<StatsQueryTop>>(request);
}
private string GetUrl()
{
return string.Format("{0}{1}/_stats/query/top?size={2}", GetServerUrl(), this.index, this.size);
}
}
// TopQueryCommand usage
public IEnumerable<StatsQueryTop> GetTopQueries(int size)
{
var topQueryCommand = searchClient.NewCommand(context => new TopQueryCommand(context, searchClient.DefaultIndex, size));
return topQueryCommand.Execute().Hits;
}
I second Eric's comment about the index not supporting statistics. I also tried to create a brand new index with activated stats, but that did not help.
I just updated one site to "New EPiServer Find" and two things broked down for me:
and
This is because this is no longer availible "using EPiServer.Find.Framework.Statistics.ForInternalUseOnly;" (Yes, I know that the name should made me not use it but... ;-) )
I can't find any articles on breaking changes yet, are there any and is there any more changes you know about?