FSDirectory storeDirectory;
storeDirectory = FSDirectory.getDirectory(storePathname);
// plan to add a set of useful stopwords, consider changing some of the
// interior filters.
StandardAnalyzer analyzer = new StandardAnalyzer(new HashSet());
// TODO: something about lock timeouts and leftover locks.
IndexWriter writer = new IndexWriter(storeDirectory, analyzer, true);
IndexSearcher searcher = new IndexSearcher(storePathname);
for(int dx = 0; dx < 1000; dx ++) {
String f = randomField();
Document doc = new Document();
doc.add(new Field("data", f, Field.Store.YES, Field.Index.TOKENIZED));
writer.addDocument(doc);
}
searcher.close();
writer.close();
rmDir(new File(storePathname));