private Directory GetIndex()
{
RAMDirectory indexStore = new RAMDirectory();
IndexWriter writer = new IndexWriter(indexStore, new StandardAnalyzer(Util.Version.LUCENE_CURRENT), true, IndexWriter.MaxFieldLength.LIMITED);
RandomGen random = new RandomGen(this, NewRandom());
for (int i = 0; i < INDEX_SIZE; ++i)
{
// don't decrease; if to low the problem doesn't show up
Document doc = new Document();
if ((i % 5) != 0)
{
// some documents must not have an entry in the first sort field
doc.Add(new Field("publicationDate_", random.GetLuceneDate(), Field.Store.YES, Field.Index.NOT_ANALYZED));
}
if ((i % 7) == 0)
{
// some documents to match the query (see below)
doc.Add(new Field("content", "test", Field.Store.YES, Field.Index.ANALYZED));
}
// every document has a defined 'mandant' field
doc.Add(new Field("mandant", System.Convert.ToString(i % 3), Field.Store.YES, Field.Index.NOT_ANALYZED));
writer.AddDocument(doc);
}
writer.Optimize();
writer.Close();
return indexStore;
}