Getting Lucene 4.10 read 3.2 version indexes Upgraded to 4.10 still need to read 3.2 indexes. Deployed jre 7 as required. Made all changes within a existing code base which became erroneous. Still need to read 3.2 indexes before going to take on re-indexing. How to read existing 3.2 indexes by Lucene 4.10 ( what changes to make if any in a code )
How to read Lucene 3.2 index by Lucene 4.10?
536 views Asked by Putnik At
2
There are 2 answers
0

You can set the codec used to decode the indexes in the IndexWriterConfig
. Lucene3xCodec
would be the codec to use here:
IndexWriterConfig config = new IndexWriterConfig(Version.LATEST, analyzer);
config.setCodec(new Lucene3xCodec());
IndexWriter writer = new IndexWriter(directory, config);
IndexSearcher searcher = new IndexSearcher(new DirectoryReader.open(writer));
Bear in mind, this codec is strictly read-only. Any attempt to add, delete, or update a document will result in an UnsupportedOperationException
being thrown. If you wish to support writing to the index, you must upgrade your index (see my original answer).
You can use
IndexUpgrader
, something like:or run it from the command line: