I’m currently a bit confused on how to accomplish limiting my search results in Lucene (v1.4.3 can’t easily upgrade for this project). Hopefully someone can help point me in the correct direction.
Essentially my application is comprised of several objects, namely User, Group, and Document (converted to lucene document). Documents may be assigned to multiple Groups (many-to-many). Users may be members of multiple groups (many-to-many). A User’s search should only return Document objects that are assigned to a group that the user is a member to. My best guess is when indexing my document I should create a field that contains all of the given document’s groups’ ids (essentially a space delimited list of unique Long values converted to strings). Given this, I will need some way to eliminate results based on the contents of this field if the searching user is not a member of any of the groups that a document is in. I’d imagine a long chain of OR and NOT clauses is not the best way of doing things here. Is this what a QueryFilter is for, if so how do I use it? I could post parse the results after the search, but I'd imagine lucene can take care of this more efficiently than I can with a large number of documents. Any help would be greatly appreciated. -Robert