Apache Solr open-source search software
SOLR-4729: testcase for catchall copyField
Chris M. Hostetter0e0378eed5dd
diff --git a/solr/core/src/test-files/solr/collection1/conf/schema-copyfield-test.xml b/solr/core/src/test-files/solr/collection1/conf/schema-copyfield-test.xmlindex eac88c017c3..d3a1862d025 100644--- a/solr/core/src/test-files/solr/collection1/conf/schema-copyfield-test.xml+++ b/solr/core/src/test-files/solr/collection1/conf/schema-copyfield-test.xml@@ -470,6 +470,8 @@<!-- test source glob that doesn't match any explicit or dynamic field --><copyField source="testing123_*" dest="text"/>+ <copyField source="*" dest="catchall_t"/>+<!-- Similarity is the scoring routine for each document vs a query.A custom similarity may be specified here, but the default is finefor most applications.diff --git a/solr/core/src/test/org/apache/solr/schema/CopyFieldTest.java b/solr/core/src/test/org/apache/solr/schema/CopyFieldTest.javaindex 796b89ae919..21fd54e2f6a 100644--- a/solr/core/src/test/org/apache/solr/schema/CopyFieldTest.java+++ b/solr/core/src/test/org/apache/solr/schema/CopyFieldTest.java@@ -245,5 +245,20 @@ public class CopyFieldTest extends SolrTestCaseJ4 {,"//*[@numFound='1']","//result/doc[1]/str[@name='id'][.='A5']");- }+ }++ public void testCatchAllCopyField() {+ IndexSchema schema = h.getCore().getSchema();++ assertNull("'*' should not be (or match) a dynamic field",+ schema.getDynamicPattern("*"));++ assertU(adoc("id", "A5", "sku1", "10-1839ACX-93", "testing123_s", "AAM46"));+ assertU(commit());+ for (String q : new String[] {"A5", "10-1839ACX-93", "AAM46" }) {+ assertQ(req("q","catchall_t:" + q)+ ,"//*[@numFound='1']"+ ,"//result/doc[1]/str[@name='id'][.='A5']");+ }+ }}