From 80a1e989380ebf17bd8b980972dfefb90bc97f8c Mon Sep 17 00:00:00 2001 From: Jeroen van Wolffelaar Date: Wed, 22 Feb 2006 00:49:57 +0000 Subject: [PATCH] Use fgrep also for description search --- lib/Packages/Search.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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); -- 2.39.2