开发者

Can I store and join based on external attributes in Lucene/Solr

开发者 https://www.devze.com 2023-01-03 01:46 出处:网络
Is there a way to store information about documents that are stored in Lucene such that I don\'t have to update the entire document to update cert开发者_StackOverflow社区ain attributes about the docum

Is there a way to store information about documents that are stored in Lucene such that I don't have to update the entire document to update cert开发者_StackOverflow社区ain attributes about the documents?

For instance, let's say I had a bunch of documents, and that I wanted to update a permissions list of who was allowed to see the documents on a daily, or more frequent, basis. Would it be possible to update all the permissions each day, without updating all the documents. I could do it by keeping a exactly which permissions were added and removed, but I would rather just be able to take the end list of permissions, and use that, rather than have to keep track of all the permission changes and post those entire documents to Lucene.


Updating individual fields is not implemented, see this related question. I agree with Karussell about not storing permissions in Solr, this seems more like a job for a RDBMS. Remember that Lucene indexes are really flat structures.


I think, you will have to update the whole document and not only properties/fields.

For your problem I wouldn't store the permission stuff into lucene/solr. I would use a database to check if a user is able to view a document. E.g. add the roles "admin", "default" and/or "anonymous" to every document in a multivalued field "role" and then e.g. if a user is logged in as admin then filter all queries by the "admin" role.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号