Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lucene Index upgrading from version 4.6 to 8.0.0

Tags:

java

lucene

I am trying to upgrade Lucene index from 4.6 to 8.0.0. When I'm trying to upgrade tool using:

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

Script is working fine from 4.6 to 5.5.5, 5.5.5 to 6.6.6, 6.6.6 to 7.7.2. But When I am trying to upgrade from 7.7.2 to 8.0.0 it is throwing error as below.

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)

We want to upgrade from 4.6 to 8.0.0. Till 7.7.2 it is upgrading without any issues, but when I'm using for Lucene version 7.7.2 in my code indexing is working fine. But Lucene 8.0.0 is not working.

Please help me in upgrading 8.0.0

like image 551
Jyothsna Avatar asked Sep 26 '19 10:09

Jyothsna


People also ask

How do I upgrade Lucene?

To read and upgrade Lucene 4. x indexes, you must add the lucene-backward-codecs. jar to the classpath. It is recommended to upgrade the old indexes with the IndexUpgrader tool, so you can remove the backward-codecs module from classpath.

Is Lucene still used?

First written in 1999 by Doug Cutting, still going strong... Apache Lucene, the full-text search library, has operated and been maintained for more than 20 years and for many developers is an integral part of their website and application builds.

What is Lucene DB?

Lucene Core is a Java library providing powerful indexing and search features, as well as spellchecking, hit highlighting and advanced analysis/tokenization capabilities.


1 Answers

  1. If we are upgrading more than one major version, we must re-index.
  2. Multiple major version upgrades have always been discouraged and never guaranteed to work, but now such upgrades are explicitly denied.
  3. When we used the IndexUpgrader from Lucene 6, the Lucene version was written into the index. The recorded version was preserved by the upgrader for version 7. When the index was subsequently read by version 8, it complained because the original index was not written by version 7 or later.
like image 114
Jyothsna Avatar answered Sep 21 '22 02:09

Jyothsna