Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-7682

Schema API - Add New Copy Field Rule doesn't allow maxChars parameter

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.2
    • Fix Version/s: 5.3, 6.0
    • Component/s: Schema and Analysis
    • Labels:
      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;
              }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                steve_rowe Steve Rowe
                Reporter:
                mariusneo Marius Grama
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: