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

Ruby response writer emits invalid integers for numbers stored with leading zeros

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: clients - ruby - flare
    • Labels:
      None

      Description

      There is an issue with the ruby response (and others too, perhaps json and python) when an "integer" field is sent with leading zeros. For example (from a report to ruby-dev@lucene), the Solr response is:

      {'responseHeader'=>{'status'=>0,'QTime'=>1,'params'=>{'wt'=>'ruby','rows'=>'1','start'=>'5','q'=>'accounting','fl'=>'zip_code','qt'=>'standard'}},'response'=>{'numFound'=>15005,'start'=>5,'docs'=>[

      {'zip_code'=>[08817]}

      ]}}

      Which gives this error:

      solr/response/ruby.rb:30:in `initialize': invalid ruby code:
      (eval):1:in `initialize': compile error (Solr::Exception) (eval):1:
      Illegal octal digit


      I had proposed prefixing all integer ruby output with '0d' which would do the trick nicely. Yonik, however, proposed simply stripping leading zeros for json and subclasses.

        Attachments

          Activity

            People

            • Assignee:
              ehatcher Erik Hatcher
              Reporter:
              ehatcher Erik Hatcher
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: