: document might be accessible by different users. I want to implement this : without indexing a document multiple times. The approach I thought of was to : use a field that is indexed, as well as stored in the index, which contains : the ids of all the users that can access the document. I could then use
The "Best" solution really depends on what determines if a user can view a document. If the set of documents visible to user "Bob" is based on a set of document properties (ie: bob can view any documents in the "reports" category that have an access level of "5" or less), then you can store the properties bob is restricted to anywhere, and at search time look them up and make a Filter out of them to apply to Bob's searches. (ie: a ChainedFilter containing a simple TermFilter on the category field and a RangeFilter on the level field) If the set of documents viewable by a given person is truely an arbitrary list of document identifiers stored in a DB somewhere, then build a Filter that knows how to access that list, and sets the bits only on the document identifiers in that list. As always: accessing the stored fields of every document in your index from a Filter is not a good idea -- make sure the identifier field is indexed, and use the FieldCache to loop over all of the keys for all of the docs The key elements to any approach being: 1) Don't store the lsit of users in the docs, that seems like a real waste. 2) Use a Filter for each user (or if possible, group of users that have access permissions in common) 3) Cache those Filters using something like CachingWrapperFilter (if your Index doesn't change very often, but you have lots of users, you may want a differnet caching approach that lets you expire Filters without closing the IndexReader. -Hoss --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]