Search code examples
solrindexingluke

Upgrade solr 1.4 index to solr 3.3?


I have an existing index build using apache solr 1.4.

I want to use this existing index in version 3.3. As you know the index format is changed after 3.x, so how is it possible to do this?

I have exported the existing index (that is in 1.4 version) using Luke to XML.


Solution

  • There's two ways to do this:

    1. if your index is unoptimized, then simply optimize it - this will upgrade the file format along the way.

    2. if your index is already optimized, you can't do this. Instead, use the command line tool supplied with solr (your path may differ from mine

      java -cp work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/lucene-core-3.3.0.jar org.apache.lucene.index.IndexUpgrader -verbose /path/to/index/directory
      

    However, note that this only changes the file format - it won't stop deprecation warnings because unless you tell it otherwise, solrconfig.xml defaults to still assuming you're using an old index format. see http://www.mail-archive.com/dev@lucene.apache.org/msg23233.html

    You may still get lots of lines like this in your logfile:

    WARNING: LowerCaseFilterFactory is using deprecated LUCENE_24 emulation. You should at some point declare and reindex to at least 3.0, because 2.x emulation is deprecated and will be removed in 4.0
    

    until you tell solrconfig.xml that you're ready to use all the features of the new index format. You do this by adding the following to solrconfig.xml (at the top level, just after the abortOnConfigurationError setting).

    <!-- Controls what version of Lucene various components of Solr
         adhere to.  Generally, you want to use the latest version to
         get all bug fixes and improvements. It is highly recommended
         that you fully re-index after changing this setting as it can
         affect both how text is indexed and queried.
      -->
    <luceneMatchVersion>LUCENE_33</luceneMatchVersion>