Try our conversational search powered by Generative AI!

FilterOnReadAccess

Vote:
 

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

#74143
Aug 21, 2013 14:38
Vote:
 

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();

#74145
Aug 21, 2013 14:41
* 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.