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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 5.2
    • 5.3, 6.0
    • Schema and Analysis
    • 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

        1. SOLR-7682.patch
          10 kB
          Steven Rowe

        Issue Links

          Activity

            People

              sarowe Steven Rowe
              mariusneo Marius Grama
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: