7

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.

Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
Tamer El-Nasser
  • 249
  • 1
  • 3
  • 6

2 Answers2

7

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>
Toby
  • 236
  • 1
  • 2
0

If you have the data: the best way is indexing all the data new in solr 3.3 You can use the data import handler to index your exported XML files.

If building up a new index is not an solution for you, you have got different possibilities:

As far as i know, Solr 3.3 can read old indexes. So one idea could be using shards. One shard for the old data (read only) an the other shard for the new data. Unfortunately, in this solution you will be unable to modify old data.

benjismith
  • 16,559
  • 9
  • 57
  • 80
The Bndr
  • 13,204
  • 16
  • 68
  • 107
  • 1.I copied the old schema.xml (1.4 v) to the new server (3.3) 2. I copied the old index to the new index directory in 3.3 and restarted the server, things went fine! The strange thing is that i read somewhere in the 3.3 release notes that the new index structure is not compatible with the old ones ... Anyway, I'm happy that things went fine :) – Tamer El-Nasser Jul 12 '11 at 07:00
  • "that the new index structure is not compatible with the old ones"...yes... i guess, that's right. But i think, your 3.3 system is running in something like an "compatibility mode" and does not use the new index format. Probably, your index is still 1.4, which is not supported in lucene 4 - if you think about an upgrade in the future. – The Bndr Jul 12 '11 at 08:21
  • You are right, but how to do the upgrade? This was my main question. – Tamer El-Nasser Jul 13 '11 at 07:05
  • Not sure, but if you go to 3.x, updates means reindex. I'm not sure, if solr4 will provide an migration tool. – The Bndr Jul 13 '11 at 07:45