Consider that I have two sets of objects "Questions" and "Users" and they share a relation.
When building my lucene index, I can index these two objects individually i.e. a document for each question and a document for each user.
Or I can have a data transfer object which will have properties from questions and users flatten in a single object and index this data transfer object.
When performing search lets say we can search by question title and question author which is just a user.
For some reason let's say my system allows a user to change his display name.
What would be the best approach to index my objects to allow latest changes to be reflected in lucene idex?
- Should I have separate documents for users and questions and have lucene get required question/user details as required?
- Or, go the data transfer object way? When there are changes just delete these documents and reindex?