If we factor the merge policy out of IndexWriter,
Discount Pandora Beads, we can allow it to be pluggable,
Cheap Tiffany, making it probable for applications to select a custom merge policy and for simpler experimenting with merge policy variants.
Here's a first cut at a factored merge policy.
It's not polished. Sparsely commented and you'll find almost certainly several alterations that really should be backed out.
It components a merge policy interface out of IndexWriter and creates an implementation of the current merge policy.
Actually,
Tiffany Wedding, it is a tweak around the current merge policy. At present the merge policy is applied in methods that presume selected points regarding the current record of segments. The factored version doesn't make these assumptions. It simplifies the interface but I am not nevertheless positive if you'll find negative negative effects. Among other points I need to operate functionality assessments.
There is a part of a pass at a concurrent model of the current merge policy. It's not comprehensive. I've been pushing it to determine if I comprehend the troubles close to concurrent merges. Fascinating matters are one) how you can manage the merges two) how/when to cascade merges if they are occurring inside a parallel and three) how to handle synchronization of IndexWriter#segmentInfos. That very last 1 particularly can be a bit touchy.
I did a fast implementation of KS's fib merge policy but it is incomplete in that IndexWriter will not likely merge non-contiguous section lists,
Tiffany Au, but I believe I can resolve that relatively effortlessly without any main unwanted effects. The factored merge policy helps make this plug in fairly clear ...