try
{doc1 = new Document();
Field f1 = new Field("name1", "smi steve ted teddy terry", Field.Store.YES, Field.Index.TOKENIZED);
Field f2 = new Field("name2", "what are you doing", Field.Store.YES, Field.Index.TOKENIZED);
Field f3 = new Field("name3", "how do you do", Field.Store.YES, Field.Index.TOKENIZED);
doc1.add(f1);
doc1.add(f2);
doc1.add(f3);
doc2 = new Document();
Field f4 = new Field("name4", "smi steve ted teddy terry", Field.Store.YES, Field.Index.TOKENIZED);
Field f5 = new Field("name4", "what are you doing", Field.Store.YES, Field.Index.TOKENIZED);
doc2.add(f4);
doc2.add(f5);
IndexWriter writer = new IndexWriter(INDEX_PATH, new StandardAnalyzer(), true);
writer.setUseCompoundFile(false);
writer.addDocument(doc1);
writer.addDocument(doc2);
writer.close();
}catch(IOException e){
e.printStackTrace();
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Segment se = new Segment();