use strict;
use warnings;
-use CGI qw( -oldstyle_urls );
+#use CGI ();
use POSIX;
use HTML::Entities;
use DB_File;
my $result = $hash->{$key} || '';
debug( "read_entry_simple: key=$key, archives=".
join(" ",(keys %$archives)).", suite=$suite", 1);
- my @data_fuzzy;
+ my (@data_fuzzy, @data_virtual, @data_fuzzy_virtual);
foreach (split /\000/o, $result) {
my @data = split ( /\s/o, $_, 8 );
debug( "Considering entry ".join( ':', @data), 2);
return \@data;
} elsif ($archives->{$data[0]}) {
debug( "Virtual entry ".join( ':', @data), 2);
+ @data_virtual = @data;
+ } elsif (($data[0] eq 'us')
+ && ($data[2] ne 'virtual')) {
+ debug( "Fuzzy entry ".join( ':', @data), 2);
@data_fuzzy = @data;
} elsif ($data[0] eq 'us') {
- debug( "Fuzzy entry ".join( ':', @data), 2);
- @data_fuzzy = @data unless @data_fuzzy;
+ debug( "Virtual fuzzy entry ".join( ':', @data), 2);
+ @data_fuzzy_virtual = @data;
}
}
}
- return \@data_fuzzy;
+ return \@data_virtual if @data_virtual;
+ return \@data_fuzzy if @data_fuzzy;
+ return \@data_fuzzy_virtual;
}
sub read_src_entry_all {
my ($hash, $key, $results, $non_results, $opts) = @_;
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 (<DESC>) {
- 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);