document3.add(new Field("field", "a different sample", Field.Store.YES, Field.Index.TOKENIZED));
document3.add(new Field("filter", "another sample filter", Field.Store.YES, Field.Index.TOKENIZED));
document3.add(new Field("sort", "1", Field.Store.YES, Field.Index.UN_TOKENIZED));
writer.addDocument(document3);
writer.optimize();
writer.close();
//Initialization of the index factory
this.indexFactory = new SimpleIndexFactory();
this.indexFactory.setDirectory(this.directory);