[OPEN-ILS-DEV] ***SPAM*** Re: ***SPAM*** Re: Sorting by distance in the OPAC

Mike Rylander mrylander at gmail.com
Mon Jul 27 13:06:36 EDT 2009


On Mon, Jul 27, 2009 at 10:56 AM, Mike Rylander<mrylander at gmail.com> wrote:
> On Tue, Jul 14, 2009 at 4:13 PM, Paul Waak<ptwaak at gmail.com> wrote:
>> I have worked out the back end for sorting the holdings in the OPAC by
>> physical distance from a location.  The idea here is to let the OPAC in a
>> library display the holdings of other libraries in the system according to
>> how far an anonymous user would have to drive to get it right away,
>> independent of administrative organization.  Presumably, the library can
>> just add ol=<id> to the OPAC URL to trigger this behavior.
>>
>> In the OPAC, I am looking at changing rdetail.js in the default skin so the
>> holdings list will be sorted by distance if:
>>
>> a global called rdetailSortDistance is true AND
>> getOrigLocation() != globalOrgTree.id() AND
>> findOrgType(getOrigLocation().ou_type()).can_have_vols()
>>
>> If any of these conditions are false, then the standard display applies.
>>
>> If all three conditions are true, then the holdings are sorted by the
>> distance of the copy's circ_lib from getOrigLocation().
>>
>> Is this in line with how getOrigLocation() was meant to be used?  Or does
>> the value represent something other than what I am thinking?  I am modifying
>> release 1.4.0.4, in case that affects the answer.
>
> Yes, that's what getOrigLocation() is for, though getLocation().  I'm

That didn't make much sense ... s/, though getLocation()//

> much more curious, as you might imagine, about the backend parts
> you've worked on.  Have you modified the staged_search stored
> procedure, and how are you storing the geospacial data or are you just
> working off the org tree proximity data, etc.
>
> A couple side notes:
>
> * I think the second test (getOrigLocation() != globalOrgTree.id()) is
> probably not needed.  I can imagine scenarios where the top of the org
> tree is a real location, and child nodes "hang off" that.  The
> can_have_vols condition seems that it would be enough to restrict to
> valid cases.
> * For the third test, you may want to use something like:
>    var here = getOrigLocation() || getLocation();
>    var this_org = findOrgUnit( here ).ou_type();
>    if (
>      isTrue( rdetailSortDistance ) &&
>      isTrue( findOrgType( this_org ).can_have_vols() )
>    ) { ... }
>
> --
> Mike Rylander
>  | VP, Research and Design
>  | Equinox Software, Inc. / The Evergreen Experts
>  | phone:  1-877-OPEN-ILS (673-6457)
>  | email:  miker at esilibrary.com
>  | web:  http://www.esilibrary.com
>



-- 
Mike Rylander
 | VP, Research and Design
 | Equinox Software, Inc. / The Evergreen Experts
 | phone:  1-877-OPEN-ILS (673-6457)
 | email:  miker at esilibrary.com
 | web:  http://www.esilibrary.com


More information about the Open-ils-dev mailing list