How can I set up a Lucene index in Sitecore that h

2019-09-16 09:48发布

I have a number of different roles in Sitecore. And I have set security permissions on my content items so that different roles can only access certain content items. It seems that Lucene will just index all of the content. And when I query Lucene it doesn't pay any attention to the security. Is there any way to get Lucene to only return items that the current Extranet user has access to?

Thanks, Corey

1条回答
祖国的老花朵
2楼-- · 2019-09-16 10:12

Not to my knowledge. But when working through the Hits collection, you would normally have a loop similar to this:

for ( int i = 0; i < hits.Length() && i < Context.Current.Settings.MaxSearchResultsToProcess; i++ )
{
    Item item = Index.GetItem( hits.Doc( i ), Context.Current.Database );
    if ( item != null )
    {
        indexResultater.Add( item );
    }
}

And since this runs in context of your current user, no results would be added to your results if the user cannot access them.

查看更多
登录 后发表回答