List of usage examples for org.apache.lucene.index TieredMergePolicy getMaxMergeAtOnceExplicit
public int getMaxMergeAtOnceExplicit()
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();/*from w w w .ja v a 2 s . c o m*/ // 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); }
From source file:org.apache.solr.update.SolrIndexConfigTest.java
License:Apache License
@Test public void testTieredMPSolrIndexConfigCreation() throws Exception { SolrConfig solrConfig = new SolrConfig("solr" + File.separator + "collection1", "solrconfig-tieredmergepolicy.xml", null); SolrIndexConfig solrIndexConfig = new SolrIndexConfig(solrConfig, null, null); assertNotNull(solrIndexConfig);/*from w ww. j a va2 s.c o m*/ IndexSchema indexSchema = IndexSchemaFactory.buildIndexSchema("schema.xml", solrConfig); IndexWriterConfig iwc = solrIndexConfig.toIndexWriterConfig(indexSchema); assertNotNull("null mp", iwc.getMergePolicy()); assertTrue("mp is not TMP", iwc.getMergePolicy() instanceof TieredMergePolicy); TieredMergePolicy mp = (TieredMergePolicy) iwc.getMergePolicy(); assertEquals("mp.maxMergeAtOnceExplicit", 19, mp.getMaxMergeAtOnceExplicit()); assertEquals("mp.segmentsPerTier", 9, (int) mp.getSegmentsPerTier()); assertNotNull("null ms", iwc.getMergeScheduler()); assertTrue("ms is not CMS", iwc.getMergeScheduler() instanceof ConcurrentMergeScheduler); ConcurrentMergeScheduler ms = (ConcurrentMergeScheduler) iwc.getMergeScheduler(); assertEquals("ms.maxMergeCount", 987, ms.getMaxMergeCount()); assertEquals("ms.maxThreadCount", 42, ms.getMaxThreadCount()); }