在学习lucene的过程中。碰到一个小问题。就是在创建IndexWriter对象的过程中,如果使用
增量索引的话,也就是使用如下方式创建IndexWriter对象时:IndexWriter write=new IndexWriter(path,new StandardAnalyzer(),[size=small]false[/size]).那么一定要保证索引文件已经存在,如果不存在,就会发生[color=blue]java.io.FileNotFoundException[/color]异常。[color=red]no segments* file found in org.apche.lucene.store.FSDirectory@E:\lucene\index:files:[/color]
所以第一次创建索引的时候一定要用到true.等创建了以后,再可以改成false。
增量索引的话,也就是使用如下方式创建IndexWriter对象时:IndexWriter write=new IndexWriter(path,new StandardAnalyzer(),[size=small]false[/size]).那么一定要保证索引文件已经存在,如果不存在,就会发生[color=blue]java.io.FileNotFoundException[/color]异常。[color=red]no segments* file found in org.apche.lucene.store.FSDirectory@E:\lucene\index:files:[/color]
所以第一次创建索引的时候一定要用到true.等创建了以后,再可以改成false。