Document doc = new Document();
doc.add (new Field ("string", "a"+i, Field.Store.NO, Field.Index.NOT_ANALYZED));
doc.add (new Field ("string", "b"+i, Field.Store.NO, Field.Index.NOT_ANALYZED));
writer.addDocument (doc);
}
writer.optimize(); // enforce one segment to have a higher unique term count in all cases
writer.close();
sort.setSort(new SortField[]{
new SortField("string", SortField.STRING),
SortField.FIELD_DOC });
// this should not throw AIOOBE or RuntimeEx