From: Jeroen van Wolffelaar Date: Wed, 22 Feb 2006 00:49:57 +0000 (+0000) Subject: Use fgrep also for description search X-Git-Tag: switch-to-templates~84 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=80a1e989380ebf17bd8b980972dfefb90bc97f8c;p=deb%2Fpackages.git Use fgrep also for description search --- diff --git a/lib/Packages/Search.pm b/lib/Packages/Search.pm index 887bc43..54998a3 100644 --- a/lib/Packages/Search.pm +++ b/lib/Packages/Search.pm @@ -460,12 +460,14 @@ sub do_fulltext_search { my $numres = 0; my %tmp_results; - open DESC, '<', "$file" + # fgrep is seriously faster than using perl + open DESC, '-|', 'fgrep', '-n', '--', $keyword, $file or die "couldn't open $file: $!"; while () { - next if (index $_, $keyword) < 0; - debug( "Matched line $.: $_", 2); - my $result = $did2pkg->{$.}; + /^(\d+)/; + my $nr = $1; + debug( "Matched line $_", 2); + my $result = $did2pkg->{$nr}; foreach (split /\000/o, $result) { my @data = split /\s/, $_, 3; # debug ("Considering $data[0], arch = $data[2]", 3);