转:
怎样合并solr索引?
有些时候,我们有两个以上的索引,然后我们需要合并它们。这里有一个简单易用的方法,使用Lucene-misc 中的 IndeMergeTool。
- 首先,确定你使用的lucene的版本。你可以从solr.war包中查到你lucene的版本。
- 下载该版本的lucene
- 需要合并的索引 必须被关闭。
- 然后,你可以使用下面的命令:java -cp /path/to/lucene-core-VERSION.jar:/path/to/lucene-misc-VERSION.jar org/apache/lucene/misc/IndexMergeTool /path/to/newindex /path/to/index1 /path/to/index2 这个命令将会把index1和index2 的索引合并到newindex中。
例子:
- java -cp /tmp/lucene-core-2007-05-20_00-04-53.jar:./lucene-2.2.0/contrib/misc/lucene-misc-2.2.0.jar org/apache/lucene/misc/IndexMergeTool ./newindex ./app1/solr/data/index ./app2/solr/data/index