views:

252

answers:

1

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 ?

+2  A: 

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.

Yaroslav
There is a trade off between indexing time and search time. If you create a one-off index, it is useful to optimize it - merge everything into a single segment. If this is a more real-time search with frequent updates, excessive merges may harm search performance as well. YMMV.
Yuval F