lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Poindexter <statics...@gmail.com>
Subject Upgrading an index with a custom codec
Date Thu, 25 Sep 2014 20:00:01 GMT
I have an index that was created in 4.5.1 using a custom Codec (actually
just the Lucene45Codec codec with the getPostingsFormatForField method
overridden to return a MemoryPostingsFormat for a particular field).  I
attempted to upgrade using IndexUpgrader to a 4.8.1 index, and it failed
with a CorruptIndexException.  Digging a little deeper, it seems
like MemoryPostingsFormat did not use a header (as supplied
by org.apache.lucene.codecs.CodecUtil) in 4.5, but now does in 4.8, so the
on-disk formats are incompatible.

I know MemoryPostingsFormat is experimental, subject to change, etc, but
has anyone given any thought to allowing an upgrade in scenarios like
this?  I think for my existing index it's too late, since the name "Memory"
is already written into the segment, and the PostingsFormat returned by
NamedSPILoader for "Memory" will be one that only allows reading 4.8
"Memory" postings.  Maybe in the future it would be nice to do something as
simple as having the PostingsFormats in the lucene-codecs package have a
version in the name (i.e. Memory45, Memory48) so that at least I could do
the work of porting the 4.5 code to 4.8 enough to allow an upgrade if
needed?  Or maybe there's some API that I'm unaware of that I can hook into
the loading of old format segments and return an alternate postings format?
(looking at the code nothing like this seems to exist, but wanted to double
check)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message