How to implement row level access control in Lucene
09.28.08 In the below example there are two fields: DATA: Which contains any data that you want your users to be able to search. NOTE: You can have as many data fields as you like. ACL_FIELD: The field used to determine what users have access to this document. Note: You can have as many access control fields as you like. All you have to do is built the access control query for each user and submit your user's query unchanged. public class TestIndexerSearcher { public static void main(String[] args) throws Exception { Directory directory = new RAMDirectory(); IndexWriter indexWriter = new IndexWriter(directory, new StandardAnalyzer()); indexWriter.addDocument(buildDocument("DATA:sametoken","ACL_FIELD:access")); indexWriter.addDocument(buildDocument("DATA:sametoken","ACL_FIELD:noaccess")); indexWriter.optimize(); indexWriter.close(); IndexSearcher indexSearcher = new IndexSearcher(directory); QueryParser parser = new QueryParser("DATA", new StandardAnalyzer()); Query query = parser.Read full article from How to implement row level access control in Lucene
No comments:
Post a Comment