Package org.apache.lucene.index

Examples of org.apache.lucene.index.MergeScheduler


   * Also each new IndexWriter needs a new MergePolicy.
   */
  private IndexWriter createNewIndexWriter() throws IOException {
    LogByteSizeMergePolicy newMergePolicy = indexParameters.getNewMergePolicy(); //TODO make it possible to configure a different policy?
    writerConfig.setMergePolicy( newMergePolicy );
    MergeScheduler mergeScheduler = new ConcurrentMergeScheduler( this.errorHandler );
    writerConfig.setMergeScheduler( mergeScheduler );
    IndexWriter writer = new IndexWriter( directoryProvider.getDirectory(), writerConfig );
    return writer;
  }
View Full Code Here


      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);
    }
  }
View Full Code Here

   * Also each new IndexWriter needs a new MergePolicy.
   */
  private IndexWriter createNewIndexWriter() throws IOException {
    LogByteSizeMergePolicy newMergePolicy = indexParameters.getNewMergePolicy(); //TODO make it possible to configure a different policy?
    writerConfig.setMergePolicy( newMergePolicy );
    MergeScheduler mergeScheduler = new ConcurrentMergeScheduler( this.errorHandler, this.indexName );
    writerConfig.setMergeScheduler( mergeScheduler );
    return new IndexWriter( directoryProvider.getDirectory(), writerConfig );
  }
View Full Code Here

   * Also each new IndexWriter needs a new MergePolicy.
   */
  private IndexWriter createNewIndexWriter() throws IOException {
    LogByteSizeMergePolicy newMergePolicy = indexParameters.getNewMergePolicy(); //TODO make it possible to configure a different policy?
    writerConfig.setMergePolicy( newMergePolicy );
    MergeScheduler mergeScheduler = new ConcurrentMergeScheduler( this.errorHandler, this.indexName );
    writerConfig.setMergeScheduler( mergeScheduler );
    return new IndexWriter( directoryProvider.getDirectory(), writerConfig );
  }
View Full Code Here

   * Also each new IndexWriter needs a new MergePolicy.
   */
  private IndexWriter createNewIndexWriter() throws IOException {
    LogByteSizeMergePolicy newMergePolicy = indexParameters.getNewMergePolicy(); //TODO make it possible to configure a different policy?
    writerConfig.setMergePolicy( newMergePolicy );
    MergeScheduler mergeScheduler = new ConcurrentMergeScheduler( this.errorHandler );
    writerConfig.setMergeScheduler( mergeScheduler );
    IndexWriter writer = new IndexWriter( directoryProvider.getDirectory(), writerConfig );
    return writer;
  }
View Full Code Here

   * Also each new IndexWriter needs a new MergePolicy.
   */
  private IndexWriter createNewIndexWriter() throws IOException {
    LogByteSizeMergePolicy newMergePolicy = indexParameters.getNewMergePolicy(); //TODO make it possible to configure a different policy?
    writerConfig.setMergePolicy( newMergePolicy );
    MergeScheduler mergeScheduler = new ConcurrentMergeScheduler( this.errorHandler );
    writerConfig.setMergeScheduler( mergeScheduler );
    IndexWriter writer = new IndexWriter( directoryProvider.getDirectory(), writerConfig );
    return writer;
  }
View Full Code Here

   * Also each new IndexWriter needs a new MergePolicy.
   */
  private IndexWriter createNewIndexWriter(DirectoryProvider<?> directoryProvider, IndexWriterConfig writerConfig, ParameterSet indexingParameters) throws IOException {
    LogByteSizeMergePolicy newMergePolicy = indexingParameters.getNewMergePolicy(); //TODO make it possible to configure a different policy?
    writerConfig.setMergePolicy( newMergePolicy );
    MergeScheduler mergeScheduler = new ConcurrentMergeScheduler( this.errorHandler );
    writerConfig.setMergeScheduler( mergeScheduler );
    IndexWriter writer = new IndexWriter( directoryProvider.getDirectory(), writerConfig );
    return writer;
  }
View Full Code Here

  public static void reduceOpenFiles(IndexWriter w) {
    // keep number of open files lowish
    LogMergePolicy lmp = (LogMergePolicy) w.getMergePolicy();
    lmp.setMergeFactor(Math.min(5, lmp.getMergeFactor()));

    MergeScheduler ms = w.getConfig().getMergeScheduler();
    if (ms instanceof ConcurrentMergeScheduler) {
      ((ConcurrentMergeScheduler) ms).setMaxThreadCount(2);
      ((ConcurrentMergeScheduler) ms).setMaxMergeCount(3);
    }
  }
View Full Code Here

    } else if (mp instanceof TieredMergePolicy) {
      TieredMergePolicy tmp = (TieredMergePolicy) mp;
      tmp.setMaxMergeAtOnce(Math.min(5, tmp.getMaxMergeAtOnce()));
    }

    MergeScheduler ms = w.getConfig().getMergeScheduler();
    if (ms instanceof ConcurrentMergeScheduler) {
      ((ConcurrentMergeScheduler) ms).setMaxThreadCount(2);
      ((ConcurrentMergeScheduler) ms).setMaxMergeCount(3);
    }
  }
View Full Code Here

      TieredMergePolicy tmp = (TieredMergePolicy) mp;
      tmp.setMaxMergeAtOnce(Math.min(5, tmp.getMaxMergeAtOnce()));
      tmp.setSegmentsPerTier(Math.min(5, tmp.getSegmentsPerTier()));
    }

    MergeScheduler ms = w.getConfig().getMergeScheduler();
    if (ms instanceof ConcurrentMergeScheduler) {
      ((ConcurrentMergeScheduler) ms).setMaxThreadCount(2);
      ((ConcurrentMergeScheduler) ms).setMaxMergeCount(3);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.index.MergeScheduler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.