Hello,

I use pylucene, and I am upgrading from 6.5.0 to 7.7.1.

Opening my old index using the new pylucene, I get

> Traceback (most recent call last):
>   ...
>   File "/home/user/jobaffinity/lib/luceneindex.py", line 58, in 
> create_lucene_index_maybe
>     writer = IndexWriter(directory, config)
> lucene.JavaError: <super: <class 'JavaError'>, <JavaError object>>
>     Java stacktrace:
> java.lang.IllegalArgumentException: Could not load codec 'Lucene62'.  Did you 
> forget to add lucene-backward-codecs.jar?
>     at org.apache.lucene.index.SegmentInfos.readCodec(SegmentInfos.java:428)
>     at org.apache.lucene.index.SegmentInfos.readCommit(SegmentInfos.java:360)
>     at org.apache.lucene.index.SegmentInfos.readCommit(SegmentInfos.java:291)
>     at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:845)
> Caused by: java.lang.IllegalArgumentException: An SPI class of type 
> org.apache.lucene.codecs.Codec with name 'Lucene62' does not exist.  You need 
> to add the corresponding JAR file supporting this SPI to your classpath.  The 
> current classpath supports the following names: [Lucene70]
>     at org.apache.lucene.util.NamedSPILoader.lookup(NamedSPILoader.java:116)
>     at org.apache.lucene.codecs.Codec.forName(Codec.java:116)
>     at org.apache.lucene.index.SegmentInfos.readCodec(SegmentInfos.java:424)
>     ... 3 more

I am really not familiar with the Java side of things. With some help from the 
web, I found out where to download the jars.

I presume I need 
http://central.maven.org/maven2/org/apache/lucene/lucene-backward-codecs/7.7.1/lucene-backward-codecs-7.7.1.jar

But then, I am quite clueless about what to do. I tried dumping the jar right 
next to lucene-core-7.7.1.jar, in my 
$(VENV)/lib/python2.7/site-packages/lucene, but that does not seem to help.

I have a large-ish index with about 22M entries, used in a public-facing 
service, so I very much like to avoid rebuilding the index every time I upgrade 
pylucene.

I could reverse-engineer this script:
https://github.com/cominvent/solr-tools/blob/master/upgradeindex/upgradeindex.sh

But that would require me to put the service down while running the migration.

How can I package the lucene-backwards-codecs in pylucene?


Reply via email to