SaaS CMS has officially launched! Learn more now.
AI OnAI Off
SaaS CMS has officially launched! Learn more now.
Sorry, pasted the wrong Code. This is what I have:
Results = SearchClient.Instance.Search<PageData>()
.For(SearchQuery).FilterOnReadAccess().Include(x => x.SearchText().AnyWordBeginsWith(SearchQuery)).Select(x => new SearchHit
{
Title = x.PageName,
Url = PageUtility.GetFriendlyUrl(x.PageLink),
File = false,
Description = x.SearchText().Shorten(200),
Category = x.SearchSection()
})
.IncludeType<SearchHit, UnifiedFile>(x => new SearchHit
{
Title = x.Name,
Url = x.VirtualPath,
File = true,
Description = x.SearchSummary().Shorten(200),
Category = x.SearchFileExtension()
})
.Skip((PagingPage - 1) * PageSize)
.Take(PageSize).Track().ApplyBestBets().GetResult();
Hi.
I'm trying to implementa search on an EPiSever 6 R2 installation.
All works well untill I tried to add the FilterOnReadAccess extension. It works fine on PageFiles, but how can I use this on UnifiedFiles?
This is my current code:
Results = SearchClient.Instance.Search<PageData>()
.For(SearchQuery).Include(x => x.SearchText().AnyWordBeginsWith(SearchQuery)).Select(x => new SearchHit
{
Title = x.PageName,
Url = PageUtility.GetFriendlyUrl(x.PageLink),
File = false,
Description = x.SearchText().Shorten(200),
Category = x.SearchSection()
})
.IncludeType<SearchHit, UnifiedFile>(x => new SearchHit
{
Title = x.Name,
Url = x.VirtualPath,
File = true,
Description = x.SearchSummary().Shorten(200),
Category = x.SearchFileExtension()
})
.Skip((PagingPage - 1) * PageSize)
.Take(PageSize).Track().ApplyBestBets().GetResult();
Regards