) {
$_ =~ $regex or next;
print "DEBUG: Matched line $.
" if $debug > 2;
@@ -306,10 +292,10 @@ if ($searchon eq 'names') {
}
close DESC;
- my $obj = tie my %packages, 'DB_File', "$DBDIR/packages_small.db", O_RDONLY, 0666, $DB_BTREE
- or die "couldn't tie DB $DBDIR/packages_small.db: $!";
- my $obj = tie my %did2pkg, 'DB_File', "$DBDIR/descriptions_packages.db", O_RDONLY, 0666, $DB_BTREE
- or die "couldn't tie DB $DBDIR/descriptions_packages.db: $!";
+ tie my %packages, 'DB_File', "$DBDIR/$lookup", O_RDONLY, 0666, $DB_BTREE
+ or die "couldn't tie DB $DBDIR/$lookup: $!";
+ tie my %did2pkg, 'DB_File', "$DBDIR/$mapping", O_RDONLY, 0666, $DB_BTREE
+ or die "couldn't tie DB $DBDIR/$mapping: $!";
my %tmp_results;
foreach my $l (@lines) {
@@ -321,8 +307,27 @@ if ($searchon eq 'names') {
}
}
foreach my $pkg (keys %tmp_results) {
- read_entry( \%packages, $pkg, \@results );
+ &$read_entry( \%packages, $pkg, \@results );
}
+ return \@results;
+}
+
+if ($searchon eq 'names') {
+ push @results, @{ do_names_search( $keyword, 'packages_small.db',
+ 'package_postfixes.db',
+ \&read_entry, \%opts ) };
+} elsif ($searchon eq 'sourcenames') {
+ push @results, @{ do_names_search( $keyword, 'sources_small.db',
+ 'source_postfixes.db',
+ \&read_src_entry, \%opts ) };
+} else {
+ push @results, @{ do_names_search( $keyword, 'packages_small.db',
+ 'package_postfixes.db',
+ \&read_entry, \%opts ) };
+ push @results, @{ do_fulltext_search( $keyword, 'descriptions.txt',
+ 'descriptions_packages.db',
+ 'packages_small.db',
+ \&read_entry, \%opts ) };
}
my $st1 = new Benchmark;
@@ -346,8 +351,8 @@ if ($format eq 'html') {
}
}
-if ($too_much_hits) {
-print "Your search was too wide so we will only display exact matches. At least $too_much_hits results have been omitted and will not be displayed. Please consider using a longer keyword or more keywords.
";
+if ($too_many_hits) {
+print "Your search was too wide so we will only display exact matches. At least $too_many_hits results have been omitted and will not be displayed. Please consider using a longer keyword or more keywords.
";
}
if (!@results) {
@@ -440,7 +445,7 @@ unless ($search_on_sources) {
$rdf->addns( debpkg => 'http://packages.debian.org/xml/01-debian-packages-rdf' );
my @triples;
foreach my $pkg (sort keys %pkgs) {
- foreach my $ver (@DISTS) {
+ foreach my $ver (@SUITES) {
if (exists $pkgs{$pkg}{$ver}) {
my @versions = version_sort keys %{$pkgs{$pkg}{$ver}};
foreach my $version (@versions) {
@@ -610,5 +615,11 @@ print <
END
+my $pete = new Benchmark;
+my $petd = timediff($pete, $pet0);
+print "Total page evaluation took ".timestr($petd)."
"
+ if $debug_allowed;
print $input->end_html;
}
+
+# vim: ts=8 sw=4