7

我有一个使用 apache solr 1.4 的现有索引构建。

我想在 3.3 版中使用这个现有的索引。如您所知,索引格式在 3.x 之后发生了变化,那么如何做到这一点呢?

我已经使用 Luke 将现有索引(即 1.4 版本)导出到 XML。

4

2 回答 2

7

有两种方法可以做到这一点:

  1. 如果您的索引未优化,则只需对其进行优化 - 这将一路升级文件格式。

  2. 如果您的索引已经优化,则不能这样做。相反,请使用 solr 提供的命令行工具(您的路径可能与我的不同

    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
    

但是,请注意,这只会更改文件格式 - 它不会停止弃用警告,因为除非您另有说明,否则 solrconfig.xml 默认仍假定您使用的是旧索引格式。见http://www.mail-archive.com/dev@lucene.apache.org/msg23233.html

您的日志文件中可能仍然会出现很多这样的行:

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

直到您告诉 solrconfig.xml 您已准备好使用新索引格式的所有功能。为此,您可以将以下内容添加到 solrconfig.xml(在顶层,就在 abortOnConfigurationError 设置之后)。

<!-- 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>
于 2011-08-26T15:53:21.920 回答
0

如果您有数据:最好的方法是索引 solr 3.3 中的所有新数据 您可以使用数据导入处理程序来索引导出的 XML 文件。

如果建立新索引不是您的解决方案,您有不同的可能性:

据我所知,Solr 3.3 可以读取旧索引。所以一个想法可能是使用分片。一个用于旧数据(只读)的分片,另一个用于新数据的分片。不幸的是,在此解决方案中,您将无法修改旧数据。

于 2011-07-11T12:36:30.690 回答