[OPEN-ILS-DEV] Patron Search - minor enhancement.

Mike Rylander mrylander at gmail.com
Wed May 4 13:32:35 EDT 2011


On Wed, May 4, 2011 at 12:44 PM, Niles Ingalls
<nilesi at zionsville.lib.in.us> wrote:
> I'd like to submit this patch, which will improve patron phone search results (at least for my purposes).
> This patch will do a match against digits only, when the search method is given a search string that only contains digits.
> Results will be improved in cases situations where number validation is loose, or where you have some legacy records that weren't fully washed.
>
>

A couple things: you'd need to create the index in the same way for it
to be effective; you'd need to apply your "remove all non-numbers"
regexp_replace to all uses; and, for the implementation below, you
need to reverse the logic in the 'if' -- it says "if it's all digits,
remove non-digits".

That said, something like this could indeed be useful, but it needs to
be systematic and implement a numbers-only index first.

>
> /openils/lib/perl5/OpenILS/Application/Storage/Publisher/actor.pm
>
> 666c666,670
> <                       push @ps, "evergreen.lowercase($p) ~ ?";
> ---
>>                       if ($pv =~ /^\d+$/) {
>>                               push @ps, "evergreen.lowercase(REGEXP_REPLACE($p, '[^0-9]', '', 'g')) ~ ?";
>>                       } else {
>>                               push @ps, "evergreen.lowercase($p) ~ ?";
>>                       }
>
>


-- 
Mike Rylander
 | VP, Research and Design
 | Equinox Software, Inc. / Your Library's Guide to Open Source
 | 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