将Lucene指数分为两半 [英] splitting lucene index into two halves

查看:53
本文介绍了将Lucene指数分为两半的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将现有Lucene索引分为两半的最佳方法是什么,即每次拆分应包含原始索引中文档总数的一半

what is the best way to split an existing Lucene index into two halves i.e. each split should contain half of the total number of documents in the original index

推荐答案

拆分现有索引(不重新索引所有文档)的最简单方法是:

The easiest way to split an existing index (without reindexing all the documents) is to:

  1. 制作现有索引的另一个副本(即cp -r myindex mycopy)
  2. 打开第一个索引,然后删除一半文档(范围从0到maxDoc/2)
  3. 打开第二个索引,然后删除另一半(范围从maxDoc/2到maxDoc)
  4. 优化两个索引

这可能不是最有效的方法,但只需很少的代码即可完成.

This is probably not the most efficient way, but it requires very little coding to do.

这篇关于将Lucene指数分为两半的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆