【问题标题】:SOLR 4.4 indexing incrementallySOLR 4.4 增量索引
【发布时间】:2014-01-28 17:10:34
【问题描述】:
当我通过以下方式开始完全导入时:
curl -X POST http://_master_host_:_port_/solr/dataimport-xml?command=full-import
它导致我们的索引增量更新。所以假设我们的库存数量是 900,000,它会突然被清除,变成 400 -> 1000 -> ... -> 900000(增量更新,而不是等待导入完成然后换出)。
我不知道为什么它会清除我们的索引,因为以前的版本会等到导入完成后再进行交换。我们所有的 solrconfig 设置都是相同的,所以我不确定是什么原因造成的。有什么想法或我缺少的东西吗?
【问题讨论】:
标签:
apache
solr
lucene
tomcat6
【解决方案1】:
找到罪魁祸首:
229 <!-- The default high-performance update handler -->
230 <updateHandler class="solr.DirectUpdateHandler2">
231 <!-- AutoCommit
232
233 Perform a hard commit automatically under certain conditions.
234 Instead of enabling autoCommit, consider using "commitWithin"
235 when adding documents.
236
237 http://wiki.apache.org/solr/UpdateXmlMessages
238
239 maxDocs - Maximum number of documents to add since the last
240 commit before automatically triggering a new commit.
241
242 maxTime - Maximum amount of time in ms that is allowed to pass
243 since a document was added before automaticly
244 triggering a new commit.
245 openSearcher - if false, the commit causes recent index changes
246 to be flushed to stable storage, but does not cause a new
247 searcher to be opened to make those changes visible.
248 -->
249 <autoCommit>
250 <maxTime>15000</maxTime>
251 <openSearcher>false</openSearcher>
252 </autoCommit>
253
254 <!-- softAutoCommit is like autoCommit except it causes a
255 'soft' commit which only ensures that changes are visible
256 but does not ensure that data is synced to disk. This is
257 faster and more near-realtime friendly than a hard commit.
258 -->
259
260 <autoSoftCommit>
261 <maxTime>1000</maxTime>
262 </autoSoftCommit>
注释掉了 autocommit 和 autosoftcommit 部分,索引不再增量更新。看来这是 solr 4 中添加的一个新参数。希望这对将来的其他人有所帮助。
编辑:这位于 SolrConfig/conf/solrconfig.xml 文件中。