]> git.deb.at Git - deb/packages.git/blobdiff - lib/Packages/DoSearchContents.pm
contents search: Give result in correct case
[deb/packages.git] / lib / Packages / DoSearchContents.pm
index 7054bb90c1ff7904c9ae6483d0894b090fb38f38..debbbb2a93e28539aef61f66556ae17871080c85 100644 (file)
@@ -75,6 +75,7 @@ sub do_search_contents {
                &searchfile(\@results, reverse($_)."/", \$nres, $reverses);
                last if $Packages::Search::too_many_hits;
            }
+           while (<FILENAMES>) {};
            close FILENAMES or warn "fgrep error: $!\n";
        } else {
 
@@ -172,8 +173,15 @@ sub searchfile
        last unless index($key, $kw) == 0;
        debug( "found $key", 2 ) if DEBUG;
 
-       my @hits = split /\0/o, $value;
-       push @$results, [ scalar reverse($key), @hits ];
+       my @files = split /\001/o, $value;
+       foreach my $f (@files) {
+           my @hits = split /\0/o, $f;
+           my $file = shift @hits;
+           if ($file eq '-') {
+               $file = reverse($key);
+           }
+           push @$results, [ $file, @hits ];
+       }
        last if ($$nres)++ > 100;
     }