}
return logmp;
}
public static TieredMergePolicy newTieredMergePolicy(Random r) {
TieredMergePolicy tmp = new TieredMergePolicy();
if (rarely(r)) {
tmp.setMaxMergeAtOnce(_TestUtil.nextInt(r, 2, 4));
tmp.setMaxMergeAtOnceExplicit(_TestUtil.nextInt(r, 2, 4));
} else {
tmp.setMaxMergeAtOnce(_TestUtil.nextInt(r, 5, 50));
tmp.setMaxMergeAtOnceExplicit(_TestUtil.nextInt(r, 5, 50));
}
tmp.setMaxMergedSegmentMB(0.2 + r.nextDouble() * 2.0);
tmp.setFloorSegmentMB(0.2 + r.nextDouble() * 2.0);
// LUCENE-3577:
//tmp.setExpungeDeletesPctAllowed(0.0 + r.nextDouble() * 30.0);
try {
Class<?> clazz = Class.forName("org.apache.lucene.index.TieredMergePolicy");
Method m = clazz.getMethod("setForceMergeDeletesPctAllowed", double.class);
m.invoke(tmp, 0.0 + r.nextDouble() * 30.0);
} catch (Exception e) {
throw new RuntimeException(e);
}
tmp.setSegmentsPerTier(_TestUtil.nextInt(r, 2, 20));
tmp.setUseCompoundFile(r.nextBoolean());
tmp.setNoCFSRatio(0.1 + r.nextDouble()*0.8);
tmp.setReclaimDeletesWeight(r.nextDouble()*4);
return tmp;
}