}
}
}
+=for description
+ for limit 0.6 to work, we need to prefer longer results over shorter ones:
+ MERGE A0246A 3078-8326 (
+ { key => "A4065A", s => 0.666666666666667 },
+ { key => "ANDREJA0246A", s => 0.666666666666667 },
+ ) val=[3]
+ .++ A0246A-3078-8326 1 .++ A0246A-3078-8326 2 result val=[3, 1, 2] result_elements=3
+=cut
+
+ if ( $#candidates > 0 ) {
+ print "XXX candidates before = ",dump( \@candidates ),$/;
+ @candidates = sort {
+ $b->{s} <=> $a->{s} # hi -> low
+ or length($b->{key}) <=> length($a->{key})
+ } @candidates;
+ print "XXX candidates after = ",dump( \@candidates ),$/;
+ }
return @candidates;
}
-foreach my $l ( 0 .. 9 ) { # 0.9 - 0.7 -- 0.6 is too lax
+#foreach my $l ( 0 .. 5 ) { # 0.9 - 0.7 -- 0.6 is too lax
+foreach my $l ( qw( 2 3 4 5 ) ) {
my $limit = 0.9 - "0.$l";
warn "XXX limit $limit\n";
my ( $num, $key_id ) = split(/-/,$id,2);
my @candidates = candidates $num => $key_id, $limit; #, 0.7; # XXX 0.9 too high, 0.8 better, 0.7 too lax
if ( @candidates ) {
- print "MERGE $num $key_id ", dump( @candidates ), ' val=', dump( \@val ), $/;
+ print "MERGE ",scalar @candidates, " $num $key_id ", dump( @candidates ), ' val=', dump( \@val ), $/;
my @keys = map { $_->{key} } @candidates;
my $m_id = $id; # "$keys[0]-$key_id";
foreach my $i ( 0 .. $#keys ) {