为什么 Lucene 合并索引?
我想知道Lucene为什么要合并索引?
更好的说法是,Lucene 为什么不将所有索引合并为一个索引呢?这种合并方法有什么好处?
I want to know why Lucene merge indexes ?
It's better to say , why does not Lucene merge all indexes to one index ? What is the advantage of this merging method ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简而言之,Lucene通过合并索引来加速搜索。毫无疑问,一个指数表现更好。但实际上,当索引足够大时,有 1 个还是 10 个索引并不重要。搜索每个索引的时间比多个索引引起的开销高出一个数量级。
这纯粹是一个实际的决定——在没有回报的情况下不进行合并。你可以自己查看lucene源代码,了解它使用的合并策略。
In short, Lucene merges indexes to speed up searching. Definitely, one index performs better. But in practice it does not matter if you have one or 10 indexes when they are large enough. The time to search each index is order of magnitude higher than overhead induced by having several indexes.
This is purely practical decision - not to merge when it does not pay off. You can look into lucene source codes by yourself and get merging strategy that it uses.