Hi all. All our existing indices are versions 2 through 3 and we're trying to migrate everything up to 5 (and then later graft additional DocValues in, but that's the next step.)
I wrote a tool which basically does this: public void upgrade2to5(Path path, int currentVersion) { if (currentVersion < 3) { try (lucene3.Directory directory = PathFSDirectory3.open(path)) { new lucene3.IndexUpgrader(directory, lucene3.Version.LUCENE_36).upgrade(); } } if (currentVersion < 4) { try (lucene4.Directory directory = PathFSDirectory4.open(path)) { new lucene4.IndexUpgrader(directory, lucene4.Version.LUCENE_4_10_4).upgrade(); } } if (currentVersion < 5) { try (Directory directory = FSDirectory.open(path)) { new IndexUpgrader(directory).upgrade(); } } } (Tech notes: A bit of glue was put in so that we could use Path with earlier versions of Lucene, since we're trying to ditch File in our own application too. Package prefixes are shortened for readability, but we basically archive the entire lucene-core for a given version into an internal package. I want to trim them down to reduce the size, but that comes after confirming that it works.) Anyway, for the oldest indices we still have available in our own test cases, this appears to work. Lucene 5 can open the index at the end. However, newer indexes which were already version 3 don't seem to upgrade properly because Lucene 5 can't open the result. I did some investigation and here's what I found so far: * Both the Lucene 4 and Lucene 5 upgrade steps succeed. * After the Lucene 4 upgrade step, the version checker I wrote says it's version 4. * After the Lucene 5 upgrade step, the version checker says it's still version 4. * After the Lucene 5 upgrade step, we try to open this index in Lucene 5 and get the exception about it being too old to open. What I don't understand: 1. Lucene 5 still opens Lucene 4 indexes (yes, we do have the backward-codecs, otherwise the migration would have failed). So this index must be Lucene *3*. How can that be, if Lucene 4's IndexUpgrader supposedly upgraded it to version 4, and even updated the headers in the files to indicate this? 2. The Lucene 5 IndexUpgrader never complained about it being out of date either. If it's really Lucene 3, why would the Lucene 5 IndexUpgrader not complain about anything? This just seems completely crazy, but I know that someone out there must have seen something like this before. What is going on here? TX --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org