views:

23

answers:

2

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 certain 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.

A: 

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.

Karussell
This really isn't optimal as I would like to be able to get back a single page of results as well as The total count with the permissions taken into account. With this method it wouldn't really be possible, and would require a lot of exra processing on the client. If I got 1000 matches, I would have to parse that large XML response, send the results to the DB and do the join there to get the final filtered list.
Kibbee
I don't understand your problem. I meant, that you can add a filterQuery to lucene/solr with the role of the user. This way you don't need to postprocess the 'large xml'
Karussell
A: 

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.

Mauricio Scheffer