Package org.apache.lucene.index

Examples of org.apache.lucene.index.MergeScheduler


   */
  private IndexWriter createNewIndexWriter() throws IOException {
    final IndexWriterConfig indexWriterConfig = writerConfig.clone(); //Each writer config can be attached only once to an IndexWriter
    LogByteSizeMergePolicy newMergePolicy = indexParameters.getNewMergePolicy(); //TODO make it possible to configure a different policy?
    indexWriterConfig.setMergePolicy( newMergePolicy );
    MergeScheduler mergeScheduler = new ConcurrentMergeScheduler( this.errorHandler, this.indexName );
    indexWriterConfig.setMergeScheduler( mergeScheduler );
    return new IndexWriter( directoryProvider.getDirectory(), indexWriterConfig );
  }
View Full Code Here


   */
  private IndexWriter createNewIndexWriter() throws IOException {
    final IndexWriterConfig indexWriterConfig = writerConfig.clone(); //Each writer config can be attached only once to an IndexWriter
    LogByteSizeMergePolicy newMergePolicy = indexParameters.getNewMergePolicy(); //TODO make it possible to configure a different policy?
    indexWriterConfig.setMergePolicy( newMergePolicy );
    MergeScheduler mergeScheduler = new ConcurrentMergeScheduler( this.errorHandler, this.indexName );
    indexWriterConfig.setMergeScheduler( mergeScheduler );
    return new IndexWriter( directoryProvider.getDirectory(), indexWriterConfig );
  }
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

      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

            listener.afterMerge(merge);
        }
    }

    public final MergeScheduler newMergeScheduler() {
        MergeScheduler scheduler = buildMergeScheduler();
        // an internal settings, that would allow us to disable this behavior if really needed
        if (indexSettings.getAsBoolean(FORCE_ASYNC_MERGE, true)) {
            scheduler = new EnableMergeScheduler(scheduler);
        }
        return scheduler;
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

      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.