On 7/30/2015 10:46 AM, Robert Farrior wrote: > We have a requirement to be able to have a master product catalog and to > create a sub-catalog of products per user. This means I may have 10,000 > users who each create their own list of documents. This is a simple mapping > of user to documents. The full data about the documents would be in the main > catalog. > > What approaches would allow Solr to only return the results that are in the > user's list? It seems like I would need a couple of steps in the process. > In other words, the main catalog has 3 documents: A, B and C. I have 2 > users. User 1 has access to documents A and C but not B. User 2 has access > to documents C and B but not A. > > When a user searches, I want to only return documents that the user has > access to.
A common approach for Solr would be to have a multivalued "user" field on each document, which has individual values for each user that can access the document. When you index the document, you included values in this field listing all the users that can access that document. Then you simply filter by user: fq=user:joe This is EXTREMELY efficient at query time, especially when the number of users is much smaller than the number of documents. It may complicate indexing somewhat, but indexing is an extremely custom operation that users have to write themselves, so it probably won't be horrible. Thanks, Shawn