Package org.apache.lucene.index

Examples of org.apache.lucene.index.LogByteSizeMergePolicy


    /**
     * Creates a new LogByteSizeMergePolicy as configured by this property set.
     * @return a new LogByteSizeMergePolicy instance.
     */
    public LogByteSizeMergePolicy getNewMergePolicy() {
      LogByteSizeMergePolicy logByteSizeMergePolicy = new LogByteSizeMergePolicy();
      for ( Map.Entry<IndexWriterSetting, Integer> entry : parameters.entrySet() ) {
        try {
          entry.getKey().applySetting( logByteSizeMergePolicy, entry.getValue() );
        }
        catch (IllegalArgumentException e) {
View Full Code Here


    /**
     * Creates a new LogByteSizeMergePolicy as configured by this property set.
     * @return a new LogByteSizeMergePolicy instance.
     */
    public LogByteSizeMergePolicy getNewMergePolicy() {
      LogByteSizeMergePolicy logByteSizeMergePolicy = new LogByteSizeMergePolicy();
      for ( Map.Entry<IndexWriterSetting, Integer> entry : parameters.entrySet() ) {
        try {
          entry.getKey().applySetting( logByteSizeMergePolicy, entry.getValue() );
        }
        catch ( IllegalArgumentException e ) {
View Full Code Here

    // :Post-Release-Update-Version.LUCENE_XY:
    // Make sure we use a MergePolicy which always merges adjacent segments and thus
    // keeps the doc IDs ordered as well (this is crucial for the taxonomy index).
    return new IndexWriterConfig(Version.LUCENE_47,
        null).setOpenMode(openMode).setMergePolicy(
        new LogByteSizeMergePolicy());
  }
View Full Code Here

   
    // hold onto IW to forceMerge
    // note how we don't close it, since DTW will close it.
    final IndexWriter iw = new IndexWriter(dir,
        new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()))
            .setMergePolicy(new LogByteSizeMergePolicy()));
    DirectoryTaxonomyWriter writer = new DirectoryTaxonomyWriter(dir) {
      @Override
      protected IndexWriter openIndexWriter(Directory directory,
          IndexWriterConfig config) throws IOException {
        return iw;
View Full Code Here

   
    // hold onto IW to forceMerge
    // note how we don't close it, since DTW will close it.
    final IndexWriter iw = new IndexWriter(dir,
        new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()))
            .setMergePolicy(new LogByteSizeMergePolicy()));
    DirectoryTaxonomyWriter writer = new DirectoryTaxonomyWriter(dir) {
      @Override
      protected IndexWriter openIndexWriter(Directory directory,
          IndexWriterConfig config) throws IOException {
        return iw;
View Full Code Here

  @Test
  public void testMergePolicyDefaults() throws Exception {
    ExposeWriterHandler uh = new ExposeWriterHandler();
    IndexWriter writer = uh.getWriter();
    LogByteSizeMergePolicy mp = (LogByteSizeMergePolicy)writer.getConfig().getMergePolicy();
    assertEquals(32.0, mp.getMaxMergeMB());
    uh.close();
  }
View Full Code Here

  public static TieredMergePolicy newTieredMergePolicy() {
    return newTieredMergePolicy(random);
  }

  public static LogMergePolicy newLogMergePolicy(Random r) {
    LogMergePolicy logmp = r.nextBoolean() ? new LogDocMergePolicy() : new LogByteSizeMergePolicy();
    logmp.setUseCompoundFile(r.nextBoolean());
    logmp.setCalibrateSizeByDeletes(r.nextBoolean());
    if (r.nextInt(3) == 2) {
      logmp.setMergeFactor(2);
    } else {
View Full Code Here

  }

  public void testMergePolicy() throws Exception {
    ExposeWriterHandler uh = new ExposeWriterHandler();
    IndexWriter writer = uh.getWriter();
    LogByteSizeMergePolicy mp = (LogByteSizeMergePolicy)writer.getConfig().getMergePolicy();
    assertEquals(64.0, mp.getMaxMergeMB());
    uh.close();
  }
View Full Code Here

  public static TieredMergePolicy newTieredMergePolicy() {
    return newTieredMergePolicy(random);
  }

  public static LogMergePolicy newLogMergePolicy(Random r) {
    LogMergePolicy logmp = r.nextBoolean() ? new LogDocMergePolicy() : new LogByteSizeMergePolicy();
    logmp.setUseCompoundFile(r.nextBoolean());
    logmp.setCalibrateSizeByDeletes(r.nextBoolean());
    if (rarely(r)) {
      logmp.setMergeFactor(_TestUtil.nextInt(r, 2, 4));
    } else {
View Full Code Here

    }
  }
 
  public void testMergePolicy() throws Exception {
    IndexWriter writer = new ExposeWriterHandler().getWriter();
    LogByteSizeMergePolicy mp = (LogByteSizeMergePolicy)writer.getMergePolicy();
    assertEquals(64.0, mp.getMaxMergeMB());
  }
View Full Code Here

TOP

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

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.