lucene-4-3-1备份报”No index commit to snapshot”异常

11月 17, 2015 |

学习lucene比较全面的资料只有《lucene in action》这本书,而它是基于lucene3.0.2版本编写的很多时候会遇到某些方法不存在的问题。google一番后发现如下的问题:
The problem is that the SnapshotDeletionPolicy you use to configure the IndexWriter initially, is NOT the same one that the IndexWriter uses. On construction, the IndexWriter actually clones the SnapshotDeletionPolicy you passed in, so the first block of code above should look like this instead:
就是说在构造IndexWriter的时候,它对传入的SnapshotDeletionPolicy对象进行了一次clone操作,所以当我们想要进行备份的时候应该使用clone后的对象,代码如下

参考文档:
http://stackoverflow.com/questions/17753226/lucene-4-3-1-backup-process

Posted in: Lucene

Comments are closed.