X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=lib%2FPackages%2FDoSearchContents.pm;h=93a20265adc4d84925451ef8da86c258defdd618;hb=f4bd5d6e5488854bc9633fb5629cc70d1045e9fa;hp=7054bb90c1ff7904c9ae6483d0894b090fb38f38;hpb=fcc4c727e97fa9124cbc1fb65c2b8de015867319;p=deb%2Fpackages.git diff --git a/lib/Packages/DoSearchContents.pm b/lib/Packages/DoSearchContents.pm index 7054bb9..93a2026 100644 --- a/lib/Packages/DoSearchContents.pm +++ b/lib/Packages/DoSearchContents.pm @@ -5,8 +5,6 @@ use warnings; use Benchmark ':hireswallclock'; use DB_File; -use URI::Escape; -use HTML::Entities; use Exporter; our @ISA = qw( Exporter ); our @EXPORT = qw( do_search_contents ); @@ -75,6 +73,7 @@ sub do_search_contents { &searchfile(\@results, reverse($_)."/", \$nres, $reverses); last if $Packages::Search::too_many_hits; } + while () {}; close FILENAMES or warn "fgrep error: $!\n"; } else { @@ -172,8 +171,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; }