Document document = new Document();
document.add(new Field("id", "1", Field.Store.YES, Field.Index.UN_TOKENIZED));
document.add(new Field("field", "a sample", Field.Store.YES, Field.Index.TOKENIZED));
document.add(new Field("filter", "a sample filter", Field.Store.YES, Field.Index.TOKENIZED));
document.add(new Field("sort", "2", Field.Store.YES, Field.Index.UN_TOKENIZED));
indexWriter.addDocument(document, new SimpleAnalyzer());
indexWriter.close();
} catch(Exception ex) {
ex.printStackTrace();
} finally {
if( indexFactory!=null ) {