Java 类org.apache.lucene.index.MergeScheduler 实例源码

项目:search    文件:TestUtil.java   
/** just tries to configure things to keep the open file
 * count lowish */
public static void reduceOpenFiles(IndexWriter w) {
  // keep number of open files lowish
  MergePolicy mp = w.getConfig().getMergePolicy();
  if (mp instanceof LogMergePolicy) {
    LogMergePolicy lmp = (LogMergePolicy) mp;
    lmp.setMergeFactor(Math.min(5, lmp.getMergeFactor()));
    lmp.setNoCFSRatio(1.0);
  } else if (mp instanceof TieredMergePolicy) {
    TieredMergePolicy tmp = (TieredMergePolicy) mp;
    tmp.setMaxMergeAtOnce(Math.min(5, tmp.getMaxMergeAtOnce()));
    tmp.setSegmentsPerTier(Math.min(5, tmp.getSegmentsPerTier()));
    tmp.setNoCFSRatio(1.0);
  }
  MergeScheduler ms = w.getConfig().getMergeScheduler();
  if (ms instanceof ConcurrentMergeScheduler) {
    // wtf... shouldnt it be even lower since its 1 by default?!?!
    ((ConcurrentMergeScheduler) ms).setMaxMergesAndThreads(3, 2);
  }
}
项目:NYBC    文件:_TestUtil.java   
/** just tries to configure things to keep the open file
 * count lowish */
public static void reduceOpenFiles(IndexWriter w) {
  // keep number of open files lowish
  MergePolicy mp = w.getConfig().getMergePolicy();
  if (mp instanceof LogMergePolicy) {
    LogMergePolicy lmp = (LogMergePolicy) mp;
    lmp.setMergeFactor(Math.min(5, lmp.getMergeFactor()));
    lmp.setUseCompoundFile(true);
  } else if (mp instanceof TieredMergePolicy) {
    TieredMergePolicy tmp = (TieredMergePolicy) mp;
    tmp.setMaxMergeAtOnce(Math.min(5, tmp.getMaxMergeAtOnce()));
    tmp.setSegmentsPerTier(Math.min(5, tmp.getSegmentsPerTier()));
    tmp.setUseCompoundFile(true);
  }
  MergeScheduler ms = w.getConfig().getMergeScheduler();
  if (ms instanceof ConcurrentMergeScheduler) {
    ((ConcurrentMergeScheduler) ms).setMaxThreadCount(2);
    ((ConcurrentMergeScheduler) ms).setMaxMergeCount(3);
  }
}
项目:incubator-blur    文件:SharedMergeScheduler.java   
public MergeScheduler getMergeScheduler() {
  return new MergeScheduler() {

    private final String _id = UUID.randomUUID().toString();

    @Override
    public void merge(IndexWriter writer) throws IOException {
      addMerges(_id, writer);
    }

    @Override
    public void close() throws IOException {
      remove(_id);
    }

    @Override
    public MergeScheduler clone() {
      return getMergeScheduler();
    }
  };
}
项目:Maskana-Gestor-de-Conocimiento    文件:_TestUtil.java   
/** just tries to configure things to keep the open file
 * count lowish */
public static void reduceOpenFiles(IndexWriter w) {
  // keep number of open files lowish
  MergePolicy mp = w.getConfig().getMergePolicy();
  if (mp instanceof LogMergePolicy) {
    LogMergePolicy lmp = (LogMergePolicy) mp;
    lmp.setMergeFactor(Math.min(5, lmp.getMergeFactor()));
    lmp.setNoCFSRatio(1.0);
  } else if (mp instanceof TieredMergePolicy) {
    TieredMergePolicy tmp = (TieredMergePolicy) mp;
    tmp.setMaxMergeAtOnce(Math.min(5, tmp.getMaxMergeAtOnce()));
    tmp.setSegmentsPerTier(Math.min(5, tmp.getSegmentsPerTier()));
    tmp.setNoCFSRatio(1.0);
  }
  MergeScheduler ms = w.getConfig().getMergeScheduler();
  if (ms instanceof ConcurrentMergeScheduler) {
    // wtf... shouldnt it be even lower since its 1 by default?!?!
    ((ConcurrentMergeScheduler) ms).setMaxMergesAndThreads(3, 2);
  }
}
项目:elasticsearch_my    文件:ElasticsearchConcurrentMergeScheduler.java   
@Override
public MergeScheduler clone() {
    // Lucene IW makes a clone internally but since we hold on to this instance
    // the clone will just be the identity.
    return this;
}
项目:search    文件:TestUtil.java   
public static void syncConcurrentMerges(MergeScheduler ms) {
  if (ms instanceof ConcurrentMergeScheduler)
    ((ConcurrentMergeScheduler) ms).sync();
}
项目:NYBC    文件:_TestUtil.java   
public static void syncConcurrentMerges(MergeScheduler ms) {
  if (ms instanceof ConcurrentMergeScheduler)
    ((ConcurrentMergeScheduler) ms).sync();
}
项目:Maskana-Gestor-de-Conocimiento    文件:_TestUtil.java   
public static void syncConcurrentMerges(MergeScheduler ms) {
  if (ms instanceof ConcurrentMergeScheduler)
    ((ConcurrentMergeScheduler) ms).sync();
}