SOLR 权限/过滤结果取决于访问权限 [英] SOLR Permissions / Filtering Results depending on Access Rights

查看:44
本文介绍了SOLR 权限/过滤结果取决于访问权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如我有文档 A、B、C.用户 1 必须只能看到文档 A、B.用户 2 必须只能看到文档 C.是否可以在 SOLR 中执行此操作而不按元数据进行过滤?如果我使用元数据过滤器,每次访问权限发生变化时,我都必须重新索引.

For example I have Documents A, B, C. User 1 must only be able to see Documents A, B. User 2 must only be able to see Document C. Is it possible to do it in SOLR without filtering by metadata? If I use metadata filter, everytime there are access right changes, I have to reindex.

[更新 2/14/2012] 不幸的是,在客户的情况下,更改很频繁.数据是机密的,通常仅由作为内部用户的所有者管理.那么具体的情况是他们需要能够将这些文档共享给某些外部用户并为这些用户指定访问级别.而且大多数时候这是一个临时任务,并没有提前确定

[update 2/14/2012] Unfortunately, in the client's case, change is frequent. Data is confidential and usually only managed by the owners which are internal users. Then the specific case is they need to be able to share those documents to certain external users and specify access levels for those users. And most of the time this is an adhoc task, and not identified ahead of time

推荐答案

我建议将访问角色(是的,它的复数形式)存储为文档元数据.这里的必填字段 access_roles 是一个可分面的多值字符串字段.

I would suggest storing the access roles (yes, its plural) as document metadata. Here the required field access_roles is a facet-able multi-valued string field.

Doc1: access_roles:[user_jane, manager_vienna] // Jane and the Vienna branch manager may see it
Doc2: access_roles:[user_john, manager_vienna, special_team] // Jane, the Vienna branch manager and a member of special team may see it

拥有该文档的用户是该文档的默认访问角色.

The user owning the document is a default access role for that document.

要更改文档的访问角色,请编辑access_roles.

To change the access roles of a document, you edit access_roles.

当 Jane 搜索时,她所属的访问角色将成为查询的一部分.Solr 将仅检索与用户访问角色匹配的文档.

When Jane searches, the access roles she belongs to will be part of the query. Solr will retrieve only the documents that match the user's access role.

当维也纳办公室 (manager_vienna) 经理 Jane (user_jane) 搜索时,她的搜索结果如下:

When Jane (user_jane), manager at vienna office (manager_vienna) searches, her searches go like:

q=mainquery
&fq=access_roles:user_jane
&fq=access_roles:manager_vienna
&facet=on
&facet.field=access_roles

获取access_roles中包含user_jane OR manager_vienna 的所有文档;Doc1Doc2.

which fetches all documents which contains user_jane OR manager_vienna in access_roles; Doc1 and Doc2.

当 Bob,(user_bob),一个特殊团队 (specia_team) 的成员搜索时,

When Bob, (user_bob), member of a special team (specia_team) searches,

q=mainquery
&fq=access_roles:user_bob
&fq=access_roles:special_team
&facet=on
&facet.field=access_roles

为他获取Doc2.

查询改编自 http://wiki.apache.org/solr/SimpleFacetParameters#Multi-Select_Faceting_and_LocalParams

这篇关于SOLR 权限/过滤结果取决于访问权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆