[ 
https://issues.apache.org/jira/browse/SOLR-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12513315
 ] 

Ryan McKinley commented on SOLR-306:
------------------------------------

Yonik - good point.  Taking that, this can be reduced to:

Index: src/java/org/apache/solr/schema/IndexSchema.java
===================================================================
--- src/java/org/apache/solr/schema/IndexSchema.java    (revision 557002)
+++ src/java/org/apache/solr/schema/IndexSchema.java    (working copy)
@@ -525,12 +525,12 @@
           else {
             dCopies.add(new DynamicCopy(source, d));
           }
-        }
-        else if( destIsPattern ) {
-          String msg =  "copyField only supports a dynamic destination if the 
source is also dynamic" ;
-          throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, msg );
         }
         else {
+          if( destIsPattern ) {
+            d = getField(dest.replace( "*", source ));
+          }
+
           // retrieve the field to force an exception if it doesn't exist
           SchemaField f = getField(source);

-------------------

Hoss-

yes, I see the concern.  After realizing that the copy field isn't anything 
special, and I essentially need to write one/field anyway, I may as well write:
 source="name" dest="text_name" 
and be done with it.

I'll close this issue, and maybe a regex version could be started later.

> copyFields with a dynamic destination should support static source
> ------------------------------------------------------------------
>
>                 Key: SOLR-306
>                 URL: https://issues.apache.org/jira/browse/SOLR-306
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Ryan McKinley
>            Priority: Minor
>             Fix For: 1.3
>
>         Attachments: SOLR-306-CopyField.patch
>
>
> In SOLR-226, we added support for copy fields with a dynamic destination.
> We should also support dynamic copyFields with a static source:
>  <copyField source="name" dest="text_*" /> 
> This will copy the contents of "name" to "text_name"

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to