writer = new IndexWriter(directory, new StandardAnalyzer(Version.LUCENE_30), false, IndexWriter.MaxFieldLength.UNLIMITED);
} catch (FileNotFoundException e) {
writer = new IndexWriter(directory, new StandardAnalyzer(Version.LUCENE_30), true, IndexWriter.MaxFieldLength.UNLIMITED);
}
indexDataResource(delegator, context, id, writer);
writer.optimize();
writer.close();
}
public static void indexDataResource(Delegator delegator, Map<String, Object> context, String id, IndexWriter writer) throws Exception {
Document doc = DataResourceDocument.Document(id, delegator, context);