Imagine this simple scenario for full text search: Articles with Comments. I want to search articles also by text in comments. That alone is fairly simple to implement.
Not all comments are visible to all users though. User that writes comment can also restrict it's visibility to concrete Role (so comment has 2 fields: text and role).
Is it possible to restrict lucene search on articles so it looks only inside comments that are visible for current user (comment.role is inside set of current user's roles)?
If so, please point me to the right direction how should I go about it and write such query (preferably) or lucene filter.
(I'm using lucene through hibernate-search but it should make no difference)