I would like to add a search filter that restricts search results for a specific document model to those documents that were created by the currently logged in user. How do I do this?
I’m trying to implement com.mgmtp.a12.services.visibility.VisibilityFilterCreator like this:
public class OwnedVisibilityFilterCreator implements VisibilityFilterCreator {
@Override
public List<String> createVisibilityFilters(UserDocument currentUser, String modelName) {
return Collections.singletonList("createdUser:\"" +
org.apache.lucene.queryparser.classic.QueryParser.escape(currentUser.getIdent().getIdent()) + "\"");
}
}
However this will never return any documents for searches even if there are documents present that were created by that user.
What should be the field of the returned filter?