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

Erik Hatcher commented on SOLR-6937:
------------------------------------

[[email protected]], I tried this:

{code}
public class NormalizeFieldNameUpdateProcessorFactory extends 
FieldMutatingUpdateProcessorFactory {
  @Override
  public UpdateRequestProcessor getInstance(SolrQueryRequest req, 
SolrQueryResponse rsp, UpdateRequestProcessor next) {
    return new FieldMutatingUpdateProcessor(getSelector(), next) {
      @Override
      protected SolrInputField mutate(SolrInputField src) {
        src.setName(src.getName().replace(' ', '_'));
        return src;
      }
   };
  }
}
{code}

And got this error: 

{code}
<lst name="error"><str name="msg">mutate returned field with different name: 
field with spaces =&gt; field_with_spaces</str><str 
name="trace">org.apache.solr.common.SolrException: mutate returned field with 
different name: field with spaces =&gt; field_with_spaces...
{code}

Are there problems that would result when changing the name of a field in 
FieldMutatingUpdateProcessor?

> In schemaless mode, field names with spaces should be converted
> ---------------------------------------------------------------
>
>                 Key: SOLR-6937
>                 URL: https://issues.apache.org/jira/browse/SOLR-6937
>             Project: Solr
>          Issue Type: Bug
>          Components: Schema and Analysis
>            Reporter: Grant Ingersoll
>            Assignee: Noble Paul
>             Fix For: 5.0
>
>
> Assuming spaces in field names are still bad, we should automatically convert 
> them to not have spaces.  For instance, I indexed Citibike public data set 
> which has: 
> {quote}
> "tripduration","starttime","stoptime","start station id","start station 
> name","start station latitude","start station longitude","end station 
> id","end station name","end station latitude","end station 
> longitude","bikeid","usertype","birth year","gender"{quote}
> My vote would be to replace spaces w/ underscores.



--
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