本文介绍了如何在Sitecore中设置可以正确处理安全性的Lucene索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Sitecore中有许多不同的角色.并且我对内容项设置了安全权限,以便不同的角色只能访问某些内容项.看起来Lucene只会索引所有内容.而且,当我查询Lucene时,并没有对安全性给予任何关注.有没有办法让 Lucene 只返回当前外联网用户有权访问的项目?

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?

谢谢,科里

推荐答案

据我所知.但是,在处理Hits集合时,通常会出现类似于以下的循环:

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.

这篇关于如何在Sitecore中设置可以正确处理安全性的Lucene索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 21:21