Example usage for org.apache.lucene.index TieredMergePolicy getNoCFSRatio

List of usage examples for org.apache.lucene.index TieredMergePolicy getNoCFSRatio

Introduction

In this page you can find the example usage for org.apache.lucene.index TieredMergePolicy getNoCFSRatio.

Prototype

public double getNoCFSRatio() 

Source Link

Document

Returns current noCFSRatio .

Usage

From source file:org.apache.solr.core.TestMergePolicyConfig.java

License:Apache License

public void testDefaultMergePolicyConfig() throws Exception {
    initCore("solrconfig-mergepolicy-defaults.xml", "schema-minimal.xml");
    IndexWriterConfig iwc = solrConfig.indexConfig.toIndexWriterConfig(h.getCore().getLatestSchema());
    assertEquals(false, iwc.getUseCompoundFile());

    TieredMergePolicy tieredMP = assertAndCast(TieredMergePolicy.class, iwc.getMergePolicy());
    assertEquals(0.0D, tieredMP.getNoCFSRatio(), 0.0D);

    assertCommitSomeNewDocs();/*  www .j  av  a2 s  . c o m*/
    assertCompoundSegments(h.getCore(), false);
}

From source file:org.apache.solr.core.TestMergePolicyConfig.java

License:Apache License

public void testLegacyMergePolicyConfig() throws Exception {
    final boolean expectCFS = Boolean.parseBoolean(System.getProperty("useCompoundFile"));

    initCore("solrconfig-mergepolicy-legacy.xml", "schema-minimal.xml");
    IndexWriterConfig iwc = solrConfig.indexConfig.toIndexWriterConfig(h.getCore().getLatestSchema());
    assertEquals(expectCFS, iwc.getUseCompoundFile());

    assertEquals("termIndexInteval", 256, iwc.getTermIndexInterval());

    TieredMergePolicy tieredMP = assertAndCast(TieredMergePolicy.class, iwc.getMergePolicy());

    assertEquals(7, tieredMP.getMaxMergeAtOnce());
    assertEquals(7.0D, tieredMP.getSegmentsPerTier(), 0.0D);
    assertEquals(expectCFS ? 1.0D : 0.0D, tieredMP.getNoCFSRatio(), 0.0D);

    assertCommitSomeNewDocs();//  w  w  w.  j a v a2 s  .c  o  m
    assertCompoundSegments(h.getCore(), expectCFS);
}

From source file:org.apache.solr.core.TestMergePolicyConfig.java

License:Apache License

public void testTieredMergePolicyConfig() throws Exception {
    final boolean expectCFS = Boolean.parseBoolean(System.getProperty("useCompoundFile"));

    initCore("solrconfig-tieredmergepolicy.xml", "schema-minimal.xml");
    IndexWriterConfig iwc = solrConfig.indexConfig.toIndexWriterConfig(h.getCore().getLatestSchema());
    assertEquals(expectCFS, iwc.getUseCompoundFile());

    TieredMergePolicy tieredMP = assertAndCast(TieredMergePolicy.class, iwc.getMergePolicy());

    // set by legacy <mergeFactor> setting
    assertEquals(7, tieredMP.getMaxMergeAtOnce());

    // mp-specific setters
    assertEquals(19, tieredMP.getMaxMergeAtOnceExplicit());
    assertEquals(0.1D, tieredMP.getNoCFSRatio(), 0.0D);
    // make sure we overrode segmentsPerTier 
    // (split from maxMergeAtOnce out of mergeFactor)
    assertEquals(9D, tieredMP.getSegmentsPerTier(), 0.001);

    assertCommitSomeNewDocs();/* w w w . ja  v a  2  s. c om*/
    // even though we have a single segment (which is 100% of the size of 
    // the index which is higher then our 0.6D threashold) the
    // compound ratio doesn't matter because the segment was never merged
    assertCompoundSegments(h.getCore(), expectCFS);

    assertCommitSomeNewDocs();
    assertNumSegments(h.getCore(), 2);
    assertCompoundSegments(h.getCore(), expectCFS);

    assertU(optimize());
    assertNumSegments(h.getCore(), 1);
    // we've now forced a merge, and the MP ratio should be in play
    assertCompoundSegments(h.getCore(), false);
}