use of org.apache.lucene.index.NoMergePolicy in project lucene-solr by apache.
the class TestMergePolicyConfig method testNoMergePolicyFactoryConfig.
public void testNoMergePolicyFactoryConfig() throws Exception {
initCore("solrconfig-nomergepolicyfactory.xml", "schema-minimal.xml");
IndexWriterConfig iwc = solrConfig.indexConfig.toIndexWriterConfig(h.getCore());
NoMergePolicy mergePolicy = assertAndCast(NoMergePolicy.class, iwc.getMergePolicy());
assertCommitSomeNewDocs();
assertCommitSomeNewDocs();
assertNumSegments(h.getCore(), 2);
assertU(optimize());
assertNumSegments(h.getCore(), 2);
deleteCore();
initCore("solrconfig-nomergepolicyfactory.xml", "schema-minimal.xml");
iwc = solrConfig.indexConfig.toIndexWriterConfig(h.getCore());
assertEquals(mergePolicy, iwc.getMergePolicy());
}
use of org.apache.lucene.index.NoMergePolicy in project lucene-solr by apache.
the class TestInPlaceUpdatesStandalone method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
System.setProperty("solr.tests.intClassName", random().nextBoolean() ? "TrieIntField" : "IntPointField");
System.setProperty("solr.tests.longClassName", random().nextBoolean() ? "TrieLongField" : "LongPointField");
System.setProperty("solr.tests.floatClassName", random().nextBoolean() ? "TrieFloatField" : "FloatPointField");
System.setProperty("solr.tests.doubleClassName", random().nextBoolean() ? "TrieDoubleField" : "DoublePointField");
// we need consistent segments that aren't re-ordered on merge because we're
// asserting inplace updates happen by checking the internal [docid]
systemSetPropertySolrTestsMergePolicyFactory(NoMergePolicyFactory.class.getName());
initCore("solrconfig-tlog.xml", "schema-inplace-updates.xml");
// sanity check that autocommits are disabled
assertEquals(-1, h.getCore().getSolrConfig().getUpdateHandlerInfo().autoCommmitMaxTime);
assertEquals(-1, h.getCore().getSolrConfig().getUpdateHandlerInfo().autoSoftCommmitMaxTime);
assertEquals(-1, h.getCore().getSolrConfig().getUpdateHandlerInfo().autoCommmitMaxDocs);
assertEquals(-1, h.getCore().getSolrConfig().getUpdateHandlerInfo().autoSoftCommmitMaxDocs);
// assert that NoMergePolicy was chosen
RefCounted<IndexWriter> iw = h.getCore().getSolrCoreState().getIndexWriter(h.getCore());
try {
IndexWriter writer = iw.get();
assertTrue("Actual merge policy is: " + writer.getConfig().getMergePolicy(), writer.getConfig().getMergePolicy() instanceof NoMergePolicy);
} finally {
iw.decref();
}
// validate that the schema was not changed to an unexpected state
IndexSchema schema = h.getCore().getLatestSchema();
for (String fieldName : Arrays.asList("_version_", "inplace_l_dvo", "inplace_updatable_float", "inplace_updatable_int", "inplace_updatable_float_with_default", "inplace_updatable_int_with_default")) {
// these fields must only be using docValues to support inplace updates
SchemaField field = schema.getField(fieldName);
assertTrue(field.toString(), field.hasDocValues() && !field.indexed() && !field.stored());
}
for (String fieldName : Arrays.asList("title_s", "regular_l", "stored_i")) {
// these fields must support atomic updates, but not inplace updates (ie: stored)
SchemaField field = schema.getField(fieldName);
assertTrue(field.toString(), field.stored());
}
// Don't close this client, it would shutdown the CoreContainer
client = new EmbeddedSolrServer(h.getCoreContainer(), h.coreName);
}
use of org.apache.lucene.index.NoMergePolicy in project lucene-solr by apache.
the class TestInPlaceUpdatesDistrib method beforeSuperClass.
@BeforeClass
public static void beforeSuperClass() throws Exception {
System.setProperty("solr.tests.intClassName", random().nextBoolean() ? "TrieIntField" : "IntPointField");
System.setProperty("solr.tests.longClassName", random().nextBoolean() ? "TrieLongField" : "LongPointField");
System.setProperty("solr.tests.floatClassName", random().nextBoolean() ? "TrieFloatField" : "FloatPointField");
System.setProperty("solr.tests.doubleClassName", random().nextBoolean() ? "TrieDoubleField" : "DoublePointField");
schemaString = "schema-inplace-updates.xml";
configString = "solrconfig-tlog.xml";
// we need consistent segments that aren't re-ordered on merge because we're
// asserting inplace updates happen by checking the internal [docid]
systemSetPropertySolrTestsMergePolicyFactory(NoMergePolicyFactory.class.getName());
initCore(configString, schemaString);
// sanity check that autocommits are disabled
assertEquals(-1, h.getCore().getSolrConfig().getUpdateHandlerInfo().autoCommmitMaxTime);
assertEquals(-1, h.getCore().getSolrConfig().getUpdateHandlerInfo().autoSoftCommmitMaxTime);
assertEquals(-1, h.getCore().getSolrConfig().getUpdateHandlerInfo().autoCommmitMaxDocs);
assertEquals(-1, h.getCore().getSolrConfig().getUpdateHandlerInfo().autoSoftCommmitMaxDocs);
// assert that NoMergePolicy was chosen
RefCounted<IndexWriter> iw = h.getCore().getSolrCoreState().getIndexWriter(h.getCore());
try {
IndexWriter writer = iw.get();
assertTrue("Actual merge policy is: " + writer.getConfig().getMergePolicy(), writer.getConfig().getMergePolicy() instanceof NoMergePolicy);
} finally {
iw.decref();
}
}
Aggregations