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

JSON Facet shorthand list syntax (Comma seperated list) doesn't trim leading/trailing spaces -- affects range "other" and "include" options (probably more)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 8.8
    • Facet Module
    • None

    Description

      when doing a type: range JSON Facet request, if you use the supported "comma seperated string" syntax instead of a true JSON List for specifing options like other or include then any whitepsace in your string is left in and breaks the parsin of those options.

      This probably affects other features of JSON Faceting that also support this comma seperated string shorthand (tag exclusions?)


      This works...

      bin/solr -e techproducts
      ...
      $ curl http://localhost:8983/solr/techproducts/query -d 'q=*:*&rows=0&omitHeader=true&json.facet=
      {x:{type:range,
          field:price,
          start:0,
          end:100,
          gap:20,
          other:"before,after"}}'
      {
        "response":{"numFound":32,"start":0,"docs":[]
        },
        "facets":{
          "count":32,
          "x":{
            "buckets":[{
                "val":0.0,
                "count":5},
      ...
            "before":{
              "count":0},
            "after":{
              "count":9}}}}
      

      This doesn't (note the subtle amount of whitespace in the error message)...

      $ curl http://localhost:8983/solr/techproducts/query -d 'q=*:*&rows=0&omitHeader=true&json.facet=
      {x:{type:range,
          field:price,
          start:0,
          end:100,
          gap:20,
          other:"before, after"}}'
      {
        "error":{
          "metadata":[
            "error-class","org.apache.solr.common.SolrException",
            "root-error-class","java.lang.IllegalArgumentException"],
          "msg":" after is not a valid type of 'other' range facet information",
          "code":400}}
      
      

      ...exagerated...

      $ curl http://localhost:8983/solr/techproducts/query -d 'q=*:*&rows=0&omitHeader=true&json.facet=
      {x:{type:range,
          field:price,
          start:0,
          end:100,
          gap:20,
          other:"before,                           after"}}'
      {
        "error":{
          "metadata":[
            "error-class","org.apache.solr.common.SolrException",
            "root-error-class","java.lang.IllegalArgumentException"],
          "msg":"                           after is not a valid type of 'other' range facet information",
          "code":400}}
      

      Attachments

        1. SOLR-12539.patch
          5 kB
          Munendra S N

        Activity

          People

            munendrasn Munendra S N
            hossman Chris M. Hostetter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: