Lucene Index 从 4.6 版本升级到 8.0.0

Lucene Index upgrading from version 4.6 to 8.0.0

我正在尝试将 Lucene 索引从 4.6 升级到 8.0.0。当我尝试使用以下方式升级工具时:

java -cp lucene-core.jar:lucene-backward-codecs.jar \
 org.apache.lucene.index.IndexUpgrader -delete-prior-commits  \
/scratch/***/workspaces/trunk/****/indexes/4.6/

4.65.5.55.5.56.6.66.6.67.7.2,脚本运行良好。但是当我尝试从 7.7.2 升级到 8.0.0 时,它会抛出如下错误。

Exception in thread "main" org.apache.lucene.index.IndexFormatTooOldException: Format version is not supported (resource BufferedChecksumIndexInput(MMapIndexInput(path="/scratch/**/workspaces/trunk/**/indexes/4.6/sd/segments_9"))): This index was initially created with Lucene 6.x while the current version is 8.0.0 and Lucene only supports reading the current and previous major versions.. This version of Lucene only supports indexes created with release 7.0 and later.
    at org.apache.lucene.index.SegmentInfos.readCommit(SegmentInfos.java:318)
    at org.apache.lucene.index.SegmentInfos.readCommit(SegmentInfos.java:289)
    at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:846)
    at org.apache.lucene.index.IndexUpgrader.upgrade(IndexUpgrader.java:167)
    at org.apache.lucene.index.IndexUpgrader.main(IndexUpgrader.java:78)

我们想从 4.6 升级到 8.0.0。直到 7.7.2 它升级没有任何问题,但是当我在我的代码索引中使用 Lucene 版本 7.7.2 时工作正常。但是 Lucene 8.0.0 不工作。

请帮我升级8.0.0

  1. 如果我们要升级一个以上的主要版本,我们必须重新索引。
  2. 多个主要版本的升级一直都是不鼓励的,也从不保证有效,但现在这样的升级被明确拒绝。
  3. 当我们使用 Lucene 6 的 IndexUpgrader 时,Lucene 版本被写入索引。记录的版本是版本7的升级者保留下来的,后来版本8读取索引的时候报错,因为原来的索引不是版本7以后写的。