November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Henrik Lindström helped me out with the answer.
This is because it triggers Find to referens and trying to serielize the whole PageData object and this wount work.
The way to solve it is to use IncludeField.
Start by creating extension methods to PageData like this:
public static string HitId(this PageData page) { return SearchClient.Instance.Conventions.IdConvention.GetId(page); } public static string HitType(this PageData page) { return SearchClient.Instance.Conventions.TypeNameConvention.GetTypeName(page.GetType()); }
Then in your class that defines what to or not to index (if you have one of those) add this:
SearchClient.Instance.Conventions.ForInstancesOf<PageData>().IncludeField(p => p.HitId()); SearchClient.Instance.Conventions.ForInstancesOf<PageData>().IncludeField(p => p.HitType());
Reindex all and then use the new property like this:
HitId = h.HitId(), HitType = h.HitType()
It works great!
Thanks again Henrik!
As I describe in this blog post http://world.episerver.com/blogs/Henrik-Fransas/Dates/2015/2/how-to-do-custom-query-and-click-tracking-with-episerver-find/ it is possible to enable click tracking for more than unified search.
Now I have run into problem with that when trying to get HitId and HitType when using projections.
I am trying to minimize what are returned by the server together with doing a multisearch and for that I am using projections.
The problem is that when I use these functions:
I get an error like this:
An exception of type JsonSerializationException was thrown while deserializing object.
With the inner exception:
"Error setting value to 'IsPendingPublish' on '[pagetype]'."
If I comment out these two lines it works great with the projection.
Anyone know how to get this to work or to work around it to get projections to work?