X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FPrefix.pm;h=0e67801d9e8f10ce494db023877ab5abcf67a439;hb=0ede244fc4076f902584ee6d088cd7fd7fd2817f;hp=3fdcdceaf8aa1823b43dedd01d3cbfb297fc28d0;hpb=d80e548735a53ddf74561e54956ddf94116608d0;p=spider.git diff --git a/perl/Prefix.pm b/perl/Prefix.pm index 3fdcdcea..0e67801d 100644 --- a/perl/Prefix.pm +++ b/perl/Prefix.pm @@ -148,10 +148,10 @@ sub matchprefix my $pref = shift; my @partials; - $pref =~ s/-\d+$//; for (my $i = length $pref; $i; $i--) { $matchtotal++; my $s = substr($pref, 0, $i); + push @partials, $s; my $p = $cache{$s}; if ($p) { $hits++; @@ -159,10 +159,10 @@ sub matchprefix my $percent = sprintf "%.1f", $hits * 100 / $misses; dbg("Partial Prefix Cache Hit: $s Hits: $hits/$misses of $matchtotal = $percent\%"); } + $cache{$_} = $p for @partials; return @$p; } else { $misses++; - push @partials, $s; my @out = get($s); if (isdbg('prefix')) { my $part = $out[0] || "*";