String indexPath = "../tmp/lucene";
System.out.println("Indexing to directory '" + indexPath + "'...");
Date start = new Date();
Directory dir = FSDirectory.open(new File(indexPath));//Dirctory dir-->FSDirectory
//需要先初始化 CNFactory
CNFactory factory = CNFactory.getInstance("../models",Models.SEG_TAG);
Analyzer analyzer = new FNLPAnalyzer(Version.LUCENE_47);
IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_47, analyzer);
iwc.setOpenMode(OpenMode.CREATE_OR_APPEND);
IndexWriter writer = new IndexWriter(dir, iwc);