开发者

how to reopen a closed indexWriter in lucene 3.2?

开发者 https://www.devze.com 2023-03-27 14:18 出处:网络
how to reop开发者_如何学Goen a closed indexWriter in lucene 3.2 and how to testify whether an indexWriter is closed?When we create instance of IndexWriter, we should do like this way

how to reop开发者_如何学Goen a closed indexWriter in lucene 3.2 and how to testify whether an indexWriter is closed?


When we create instance of IndexWriter, we should do like this way

IndexWriterConfig iwc = new IndexWriterConfig(analyzer);   
iwc.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND);

If IndexWriterConfig.OpenMode.CREATE_OR_APPEND is used IndexWriter will create a new index if there is not already an index at the provided path and otherwise open the existing index.

The above is from : https://lucene.apache.org/core/4_6_0/core/org/apache/lucene/index/IndexWriter.html

0

精彩评论

暂无评论...
验证码 换一张
取 消