I'm trying throught the community's visithandler get top 5 viewed cms pages in a certain time period.
For example, The most viewed at http://world.episerver.com/Articles/
But the problem with worlds articles is that they are based on the beginning of publish. We find it more interesting in visit in the latest month.
I'm tring to use the Visitquery, and setup quite simple:
var visitQuery = new VisitQuery();
visitQuery.VisitedDate = new DateTimeCriterion();
visitQuery.VisitedDate.Operator = ComparisonOperator.GreaterThan | ComparisonOperator.Equals;
visitQuery.VisitedDate.Value = DateTime.Now.AddDays(-5);
visitQuery.VisitedDate.Operator2 = ComparisonOperator.LessThan | ComparisonOperator.Equals;
visitQuery.VisitedDate.Value2 = DateTime.Now;
var result = QueryHandler.Instance.GetQueryResult<PageDataCommunityEntity, EntityCollection>(visitQuery);
However, this results in mypage thingy exception:
could not resolve property: VisitedDate of: EPiServer.Community.MyPage.Visit [SELECT EPiServerCommunityMyPageVisit FROM EPiServer.Community.MyPage.Visit AS EPiServerCommunityMyPageVisit WHERE ((EPiServerCommunityMyPageVisit.VisitedDate >= :p0 AND EPiServerCommunityMyPageVisit.VisitedDate <= :p1)) ]
I easilly get most viewed as world does by
var mostVisitedNews = VisitHandler.Instance.GetVisitedItems(typeof(PageDataCommunityEntity),
EntityStatus.Approved, 1, 100, TimeSpan.MinValue, out totalItems,
new VisitableEntitySortOrder(VisitableEntitySortField.NumVisits, SortingDirection.Descending));
<p>The generic arguments used with GetQueryResult look incorrect (you'll get MyPage.Visit objects from MyPage.VisitQuery).</p>
<p></p>
<p>While it does appear that MyPage.VisitQuery may not be what you needed (it looks like you are dealing with the generic visits, not the older mypage-specific visits) it does seem like there may be a bug in the Mypage.Visit query handling because other than the generic arguments the query looks valid. </p>
<p></p>
<p>Assuming the problem remains after correcting the generic arguments I would ask you to <a href="../../../Support/Register-Support-Incident/">contact Support</a> to further investigate that problem.</p>
I'm trying throught the community's visithandler get top 5 viewed cms pages in a certain time period.
For example, The most viewed at http://world.episerver.com/Articles/
But the problem with worlds articles is that they are based on the beginning of publish. We find it more interesting in visit in the latest month.
I'm tring to use the Visitquery, and setup quite simple:
However, this results in mypage thingy exception:
could not resolve property: VisitedDate of: EPiServer.Community.MyPage.Visit [SELECT EPiServerCommunityMyPageVisit FROM EPiServer.Community.MyPage.Visit AS EPiServerCommunityMyPageVisit WHERE ((EPiServerCommunityMyPageVisit.VisitedDate >= :p0 AND EPiServerCommunityMyPageVisit.VisitedDate <= :p1)) ]
I easilly get most viewed as world does by
But again, that is not the solution I'm after.