2 foxchang foxchang 于 2015.05.28 17:17 提问

Lucene 4.7.2 PersistentSnapshotDeletionPolicy

大家好,最近因项目需求,要把Lucene从之前的3.6替换到4.7.2。经测试,发现:在设置数据备份时,PersistentSnapshotDeletionPolicy没有在对应的文件路径下生成对应的备份文件,求路过大神指点迷津。
下面是声明snapshot对象的codes:

        final String backupFile = LuceneUtility.generateBackupPath(indexFilePath);
            if (backupFile != null) {
                final File bFile = new File(backupFile);

                if(!bFile.exists()){
                    bFile.mkdirs();
                }
                snapShotDir = new MMapDirectory(bFile);

                snapshotter = new PersistentSnapshotDeletionPolicy(
                        new KeepOnlyLastCommitDeletionPolicy(),
                        snapShotDir);
                // Set the snapshot policy
                indexWriterConfig.setIndexDeletionPolicy(snapshotter);
Csdn user default icon
上传中...
上传图片
插入图片