[Koha-patches] [PATCH] Modifications to C4/Matcher for colon and ending punctuation
David Bavousett
david.bavousett at liblime.com
Fri Dec 26 23:18:58 CET 2008
Recommended by Michele Maenpaa, this adds handling colon and
end-punctuation stripping
in subroutine _normalize, and fixes length testing in subroutine _get_match_keys
---
C4/Matcher.pm | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/C4/Matcher.pm b/C4/Matcher.pm
index 645b2ad..294c481 100644
--- a/C4/Matcher.pm
+++ b/C4/Matcher.pm
@@ -786,6 +786,11 @@ sub _get_match_keys {
}
}
$key = _normalize($key);
+ if ($component->{'length'}){
+ if (length($key) > $component->{'length'}){
+ $key =
_normalize(substr($key,$component->{'offset'},$component{'length'}));
+ }
+ }
}
if ($i == 0) {
push @keys, $key if $key;
@@ -815,10 +820,12 @@ sub _parse_match_component {
# FIXME - default normalizer
sub _normalize {
my $value = uc shift;
+ $value =~ s/.;:,\]\[\)\(\/'"//g;
$value =~ s/^\s+//;
- $value =~ s/^\s+$//;
+ #$value =~ s/^\s+$//;
+ $value =~ s/\s+$//;
$value =~ s/\s+/ /g;
- $value =~ s/[.;,\]\[\)\(\/"']//g;
+ #$value =~ s/[.;,\]\[\)\(\/"']//g;
return $value;
}
--
1.6.0.4
More information about the Koha-patches
mailing list