[OPEN-ILS-DEV] Different OSRF response format from different servers?

Mike Rylander mrylander at gmail.com
Wed Jan 25 12:21:12 EST 2017


Ken,

Any time a variable is used as a string (or a number), perl starts
treating it that way for stringification purposes.  As the code
changes version to version, and even as different code paths are taken
within one version depending on settings, perl may change the variable
type.  Like Bill says, if you expect a number it's best to just use,
say, parseInt() from JS or it's equiv.

HTH,

--
Mike Rylander
 | President
 | Equinox Software, Inc. / Open Your Library
 | phone:  1-877-OPEN-ILS (673-6457)
 | email:  miker at esilibrary.com
 | web:  http://www.esilibrary.com


On Wed, Jan 25, 2017 at 10:38 AM, Bill Erickson <berickxx at gmail.com> wrote:
> Hi Ken,
>
> I can't say why they vary in this specific case, but it's not uncommon for
> numbers to be packaged as JSON strings throughout Evergreen / OpenSRF.
> Generally, Perl and JavaScript don't care and the OpenSRF JSON C library is
> well-equipped to handle it.  It's probably best to assume that any number
> might be delivered as a JSON number or a JSON string.
>
> -b
>
>
>
>
> On Tue, Jan 24, 2017 at 5:03 PM, Ken Cox <kenstir at gmail.com> wrote:
>>
>> I have a bug report that searching the Missouri Evergreen catalog crashes
>> the Android Hemlock App.  I tracked it down to different results from the
>> open-ils.search.biblio.multiclass.query .  The server at
>> issourievergreen.org returns an "ids" list containing integers, and the
>> other servers I tried return an "ids" list containing strings.
>>
>> Is this expected?  Handling this one mismatch is straightforward, but I'm
>> wondering how many similar issues lurk behind this one.
>>
>> Sample search queries and excerpted results for "pride and prejudice":
>>
>> missourievergreen, version 2-11-0
>>
>>
>> https://missourievergreen.org/osrf-gateway-v1?service=open-ils.search&method=open-ils.search.biblio.multiclass.query&param=%7B%22org_unit%22:1,%22default_class%22:%22keyword%22,%22offset%22:0,%22limit%22:2,%22depth%22:0%7D&param=%22pride%20and%20prejudice%22&param=1
>> ...
>> "ids":[[32673,null,"0.0"],[886843,null,"0.0"]]
>>
>> gapines, version 2-11-1
>>
>>
>> https://gapines.org/osrf-gateway-v1?service=open-ils.search&method=open-ils.search.biblio.multiclass.query&param=%7B%22org_unit%22:1,%22default_class%22:%22keyword%22,%22offset%22:0,%22limit%22:2,%22depth%22:0%7D&param=%22pride%20and%20prejudice%22&param=1
>> ...
>> "ids":[["503610",null,"0.0"],["502717",null,"0.0"]]
>>
>> cwmars, version 2-10-7
>>
>>
>> http://bark.cwmars.org/osrf-gateway-v1?service=open-ils.search&method=open-ils.search.biblio.multiclass.query&param=%7B%22org_unit%22:1,%22default_class%22:%22keyword%22,%22offset%22:0,%22limit%22:2,%22depth%22:0%7D&param=%22pride%20and%20prejudice%22&param=1
>> ...
>> "ids":[["1805532"],["2385399"]]
>>
>>
>>
>> --
>> -Ken
>
>


More information about the Open-ils-dev mailing list