Skip to content

Commit b875c47

Browse files
committed
fix bug where exact match was returned in dist form
also cleanup some useless warnings
1 parent 2465f5c commit b875c47

File tree

1 file changed

+4
-1
lines changed
  • lib/MetaCPAN/Document/File

1 file changed

+4
-1
lines changed

lib/MetaCPAN/Document/File/Set.pm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,11 +559,14 @@ sub autocomplete_using_suggester {
559559
( $_->{fields}{documentation}[0] => $_->{fields}{distribution}[0] )
560560
} @{ $data->{hits}{hits} };
561561

562-
my $exact = delete $valid{$query};
562+
# remove any exact match, it will be added later
563+
my $exact;
564+
$exact = $query if defined delete $valid{$query};
563565

564566
my $favorites
565567
= $self->agg_by_distributions( [ values %valid ] )->{favorites};
566568

569+
no warnings 'uninitialized';
567570
my @sorted = sort {
568571
$favorites->{ $valid{$b} } <=> $favorites->{ $valid{$a} }
569572
|| $docs{$b} <=> $docs{$a}

0 commit comments

Comments
 (0)