Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
5.2
-
None
Description
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 :
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
(after creating a core
bin/solr create -c films
, and creating two text fields
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 } }'
the error message shown is
"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"]}]}
which occurs due to the handling in SchemaManager.java file
if ( ! op.getValuesExcluding(SOURCE, DESTINATION).isEmpty()) { op.addError("Only the '" + SOURCE + "' and '" + DESTINATION + "' params are allowed with the 'add-copy-field' operation"); return false; }