Marius Grama created SOLR-7682:
----------------------------------

             Summary: Schema API - Add New Copy Field Rule doesn't allow 
maxChars parameter
                 Key: SOLR-7682
                 URL: https://issues.apache.org/jira/browse/SOLR-7682
             Project: Solr
          Issue Type: Bug
          Components: Schema and Analysis
    Affects Versions: 5.2
            Reporter: Marius Grama
            Priority: Minor
             Fix For: 5.3, Trunk


As shown in the Schema API documentation
https://cwiki.apache.org/confluence/display/solr/Schema+API#SchemaAPI-AddaNewCopyFieldRule

 when adding a new copy field rule, the _maxChars_ argument can be also 
specified.

When trying to execute the request : 
{code}
curl -X POST -H 'Content-type:application/json' --data-binary '{
  "add-copy-field":{
     "source":"name",
     "dest":[ "secondname"],
     "maxChars" : "3000"}
}' http://localhost:8983/solr/films/schema
{code}
(after creating a core {code}bin/solr create -c films{code}, and creating two 
text fields
{code}
curl http://localhost:8983/solr/films/schema -X POST -H 
'Content-type:application/json' --data-binary '{
    "add-field" : {
        "name":"name",
        "type":"text_general",
        "stored":true
    },
   "add-field" : {
        "name":"secondname",
        "type":"text_general",
        "stored":true
    }
}'
{code}

the error message shown is 
{code}
  "responseHeader":{
    "status":0,
    "QTime":1},
  "errors":[{
      "add-copy-field":{
        "source":"name",
        "dest":["secondname"],
        "maxChars":"3000"},
      "errorMessages":["Only the 'source' and 'dest' params are allowed with 
the 'add-copy-field' operation"]}]}
{code}

which occurs due to the handling in SchemaManager.java file
{code}
        if ( ! op.getValuesExcluding(SOURCE, DESTINATION).isEmpty()) {
          op.addError("Only the '" + SOURCE + "' and '" + DESTINATION
              + "' params are allowed with the 'add-copy-field' operation");
          return false;
        }
{code}




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