lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [16/46] lucene-solr:jira/solr-9959: 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
Date Thu, 23 Mar 2017 11:50:03 GMT
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


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/4ee7fc38
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/4ee7fc38
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/4ee7fc38

Branch: refs/heads/jira/solr-9959
Commit: 4ee7fc38907a94f025785ebd388dd372b260913d
Parents: 1439794
Author: David Smiley <dsmiley@apache.org>
Authored: Thu Mar 16 18:30:57 2017 -0400
Committer: David Smiley <dsmiley@apache.org>
Committed: Thu Mar 16 18:30:57 2017 -0400

----------------------------------------------------------------------
 .../conf/solrconfig-managed-schema.xml          | 25 +++++++++++++++++
 .../org/apache/solr/search/LargeFieldTest.java  | 29 ++++++++------------
 2 files changed, 37 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4ee7fc38/solr/core/src/test-files/solr/collection1/conf/solrconfig-managed-schema.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig-managed-schema.xml
b/solr/core/src/test-files/solr/collection1/conf/solrconfig-managed-schema.xml
index 26224ad..c1390c8 100644
--- a/solr/core/src/test-files/solr/collection1/conf/solrconfig-managed-schema.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig-managed-schema.xml
@@ -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>

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4ee7fc38/solr/core/src/test/org/apache/solr/search/LargeFieldTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/LargeFieldTest.java b/solr/core/src/test/org/apache/solr/search/LargeFieldTest.java
index d05c69c..09e7e90 100644
--- a/solr/core/src/test/org/apache/solr/search/LargeFieldTest.java
+++ b/solr/core/src/test/org/apache/solr/search/LargeFieldTest.java
@@ -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");
-    initCore("solrconfig-managed-schema.xml", "ignoredSchemaName?");
+    System.setProperty("documentCache.enabled", "true");
+    System.setProperty("enableLazyFieldLoading", "true");
 
-    // 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());
-    }
+    initCore("solrconfig-managed-schema.xml", "ignoredSchemaName?");
 
+    // 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)


Mime
View raw message