mirror of https://github.com/apache/lucene.git
SOLR-10286: fix test; we were writing to read-only dir.
Expand solrconfig-managed-schema.xml to have toggle-able elements vis system property flags
This commit is contained in:
parent
1f585da2c1
commit
6875d7edbc
|
@ -29,6 +29,31 @@
|
|||
|
||||
<codecFactory class="solr.SchemaCodecFactory"/>
|
||||
|
||||
<query>
|
||||
<filterCache
|
||||
enabled="${filterCache.enabled:false}"
|
||||
class="solr.search.FastLRUCache"
|
||||
size="512"
|
||||
initialSize="512"
|
||||
autowarmCount="2"/>
|
||||
|
||||
<queryResultCache
|
||||
enabled="${queryResultCache.enabled:false}"
|
||||
class="solr.search.LRUCache"
|
||||
size="512"
|
||||
initialSize="512"
|
||||
autowarmCount="2"/>
|
||||
|
||||
<documentCache
|
||||
enabled="${documentCache.enabled:false}"
|
||||
class="solr.search.LRUCache"
|
||||
size="512"
|
||||
initialSize="512"
|
||||
autowarmCount="0"/>
|
||||
|
||||
<enableLazyFieldLoading>${enableLazyFieldLoading:false}</enableLazyFieldLoading>
|
||||
</query>
|
||||
|
||||
<updateHandler>
|
||||
<updateLog enable="${enable.update.log}">
|
||||
<str name="dir">${solr.ulog.dir:}</str>
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.apache.solr.request.SolrQueryRequestBase;
|
|||
import org.apache.solr.response.SolrQueryResponse;
|
||||
import org.apache.solr.schema.IndexSchema;
|
||||
import org.apache.solr.util.RefCounted;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -40,29 +41,17 @@ public class LargeFieldTest extends SolrTestCaseJ4 {
|
|||
|
||||
@BeforeClass
|
||||
public static void initManagedSchemaCore() throws Exception {
|
||||
// TODO propose convenience API for this?
|
||||
// This testing approach means no new solrconfig or schema file or per-test temp solr-home!
|
||||
// This testing approach means no schema file or per-test temp solr-home!
|
||||
System.setProperty("managed.schema.mutable", "true");
|
||||
System.setProperty("managed.schema.resourceName", "schema-one-field-no-dynamic-field-unique-key.xml");
|
||||
System.setProperty("enable.update.log", "false");
|
||||
System.setProperty("documentCache.enabled", "true");
|
||||
System.setProperty("enableLazyFieldLoading", "true");
|
||||
|
||||
initCore("solrconfig-managed-schema.xml", "ignoredSchemaName?");
|
||||
|
||||
// modify solr config TODO propose more convenient API for this; maybe with JSON-ification of a map
|
||||
try (SolrQueryRequestBase req = (SolrQueryRequestBase) req()) {
|
||||
req.getContext().put("httpMethod", "POST");
|
||||
req.setContentStreams(Collections.singleton(new ContentStreamBase.StringStream(
|
||||
"{ 'set-property':{" +
|
||||
"'query.enableLazyFieldLoading':true, " +
|
||||
"'query.documentCache.class':'solr.LRUCache'" +
|
||||
"}}"
|
||||
)));
|
||||
SolrQueryResponse rsp = new SolrQueryResponse();
|
||||
h.getCore().execute(h.getCore().getRequestHandler("/config"), req, rsp);
|
||||
assertNull(rsp.getException());
|
||||
}
|
||||
|
||||
// TODO SOLR-10229 will make this easier
|
||||
boolean PERSIST_FALSE = false; // don't write to test resource dir
|
||||
|
||||
IndexSchema schema = h.getCore().getLatestSchema();
|
||||
schema = schema.addFieldTypes(Collections.singletonList(
|
||||
schema.newFieldType("textType", "solr.TextField", // redundant; TODO improve api
|
||||
|
@ -78,6 +67,12 @@ public class LargeFieldTest extends SolrTestCaseJ4 {
|
|||
h.getCore().setLatestSchema(schema);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClass() {
|
||||
System.clearProperty("documentCache.enabled");
|
||||
System.clearProperty("enableLazyFieldLoading");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
// add just one document (docid 0)
|
||||
|
|
Loading…
Reference in New Issue