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

Steve Rowe commented on SOLR-7542:
----------------------------------

The issue is that the schema can't be persisted once there are no more dynamic 
copy fields (glob copy field directives).

One workaround is to first add another copy field directive (e.g. 
{{\*unlikely_field_suffix}}\->{{\_text\_}}).  The copy field directive that you 
want to remove ({{*}}->{{\_text\_}} in our example) can then be successfully 
deleted.

The fix is a null check on the internal array containing the dynamic copy 
fields.

AFAICT, this is also a problem in schemas that start out with zero dynamic copy 
fields - in that case I think it won't be possible to make any schema 
modifications at all.

> Schema API: Can't remove single dynamic copy field directive
> ------------------------------------------------------------
>
>                 Key: SOLR-7542
>                 URL: https://issues.apache.org/jira/browse/SOLR-7542
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 5.1
>            Reporter: Steve Rowe
>            Assignee: Steve Rowe
>             Fix For: 5.2
>
>
> In a managed schema containing just a single dynamic copy field directive - 
> i.e. a glob source or destination - deleting the copy field directive fails.  
> For example, the default configset (data_driven_schema_configs) has such a 
> schema: the {{*}}->{{\_text\_}} copy field directive is the only one. 
> To reproduce:
> {noformat}
> bin/solr start -c
> bin/solr create my_solr_coll
> curl "http://localhost:8983/solr/my_solr_coll/schema"; 
> -d'{"delete-copy-field":{"source":"*", "dest":"_text_"}}'
> {noformat}
> The deletion fails, and an NPE is logged: 
> {noformat}
> ERROR - 2015-05-13 12:37:36.780; [my_solr_coll shard1 core_node1 
> my_solr_coll_shard1_replica1] org.apache.solr.common.SolrException; 
> null:java.lang.NullPointerException
>         at 
> org.apache.solr.schema.IndexSchema.getCopyFieldProperties(IndexSchema.java:1450)
>         at 
> org.apache.solr.schema.IndexSchema.getNamedPropertyValues(IndexSchema.java:1406)
>         at org.apache.solr.schema.IndexSchema.persist(IndexSchema.java:390)
>         at 
> org.apache.solr.schema.SchemaManager.doOperations(SchemaManager.java:120)
>         at 
> org.apache.solr.schema.SchemaManager.performOperations(SchemaManager.java:94)
>         at 
> org.apache.solr.handler.SchemaHandler.handleRequestBody(SchemaHandler.java:57)
>         at 
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143)
>         at org.apache.solr.core.SolrCore.execute(SolrCore.java:1984)
>         at 
> org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:829)
>         at 
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:446)
>         at 
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:220)
> [...]
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to