if (tempDir == null)
throw new IOException("java.io.tmpdir undefined, cannot run test");
indexDir = new File(tempDir, "RAMDirIndex");
Directory dir = FSDirectory.open(indexDir);
IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
// add some documents
Document doc = null;
for (int i = 0; i < docsToAdd; i++) {
doc = new Document();
doc.add(new Field("content", English.intToEnglish(i).trim(), Field.Store.YES, Field.Index.NOT_ANALYZED));