Package org.apache.lucene.index

Examples of org.apache.lucene.index.MergeScheduler


      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


      _writers.remove(writer);
    }
  }

  public MergeScheduler getMergeScheduler() {
    return new MergeScheduler() {

      private IndexWriter _writer;

      @Override
      public void merge(IndexWriter writer) throws IOException {
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

   * 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 );
    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, this.indexName );
    writerConfig.setMergeScheduler( mergeScheduler );
    IndexWriter writer = new IndexWriter( directoryProvider.getDirectory(), writerConfig );
    return writer;
  }
View Full Code Here

      return writer;
    try {
      writer = new IndexWriter( directoryProvider.getDirectory(), SIMPLE_ANALYZER, false, maxFieldLength ); // has been created at init time
      indexingParams.applyToWriter( writer, batchmode );
      writer.setSimilarity( similarity );
      MergeScheduler mergeScheduler = new ConcurrentMergeScheduler( this.errorHandler );
      writer.setMergeScheduler( mergeScheduler );
      log.trace( "IndexWriter opened" );
    }
    catch ( IOException ioe ) {
      writer = null;
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

      }
      if (config.mergeFactor != -1 && getMergePolicy() instanceof LogMergePolicy) {
        setMergeFactor(config.mergeFactor);
      }
      if (config.mergeSchedulerClassname != null && SolrIndexConfig.DEFAULT_MERGE_SCHEDULER_CLASSNAME.equals(config.mergeSchedulerClassname) == false) {
        MergeScheduler scheduler = (MergeScheduler) schema.getSolrConfig().getResourceLoader().newInstance(config.mergeSchedulerClassname);
        setMergeScheduler(scheduler);
      }

      //if (config.commitLockTimeout != -1) setWriteLockTimeout(config.commitLockTimeout);
    }
View Full Code Here

      // keep looping until all the references are gone
    }
  }

  public MergeScheduler getMergeScheduler() {
    return new MergeScheduler() {

      private IndexWriter _writer;

      @Override
      public void merge(IndexWriter writer) throws IOException {
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.