Masoud Tavazoei Masoud Tavazoei - 3 months ago 15
Java Question

Lucene Format version is not supported

For our project we are using

Lucene 5.5.0
library to create Lucene shards, however there is one ETL job for which, we need to create Lucene 4.10.3 shards so that we can index the shards in
Solr cloud
. I'd like to keep the Lucene version as 5.5.0, so I am trying to set the version through the API to be more specific I do this:

val analyzer = new KeywordAnalyzer()
val luceneVersion = Version.parseLeniently(version)
analyzer.setVersion(luceneVersion)


However when I try to index the generated shards into
Solr cloud
I get the following error message:


Error CREATEing SolrCore 'ac_test2_shard2_replica1': Unable to create core [ac_test2_shard2_replica1] Caused by: Format version is not supported (resource: BufferedChecksumIndexInput(segments_1)): 6 (needs to be between 0 and 3)


Which based on this post is due to the fact that created Lucene version are not compatible with
Solr cloud
version. Can someone help me to understand why the created shards are still not compatible and how can I create a compatible older version shards?

Answer

Simply setting the version in the analyzer isn't going to do anything about the format of the index. All that does it make sure you are using familiar analysis rules, it has nothing to do with this problem.

You need to use the appropriate codec to write an index in an older format. Particularly Lucene410Codec. You can set the codec to use in your IndexWriterConfig. The backwards-codecs are primarily intended to read old indexes, rather than write them. I don't know for sure whether using it for your purpose would even work.

If possible, I would recommend you just use compatible Lucene versions instead. Either upgrade your Solr instance, or just use Lucene 4.10 for this job.