X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=lib%2FPackages%2FSearch.pm;h=6ae7d9722173de7bf89aa99ab37b7259d1c36b06;hb=5ac2b90beab477b44b863b2aa895e8fb3fedcd07;hp=b616f6f213de0b23392632af6b1be19ae4158810;hpb=dc9512b1309f4c8c6bd1171b543183e8ac8b2115;p=deb%2Fpackages.git diff --git a/lib/Packages/Search.pm b/lib/Packages/Search.pm index b616f6f..6ae7d97 100644 --- a/lib/Packages/Search.pm +++ b/lib/Packages/Search.pm @@ -348,7 +348,7 @@ sub read_entry_all { if ($opts->{h_archives}{$data[0]} && $opts->{h_suites}{$data[1]} && ($opts->{h_archs}{$data[2]} || $data[2] eq 'all' || $data[2] eq 'virtual') - && ($opts->{h_sections}{$data[3]} || $data[3] eq '-')) { + && ($opts->{h_sections}{$data[3]} || $data[3] eq 'v')) { debug( "Using entry ".join( ':', @data), 2); push @$results, [ $key, @data ]; } else { @@ -442,26 +442,19 @@ sub do_fulltext_search { my ($keyword, $file, $did2pkg, $packages, $read_entry, $opts) = @_; my @results; +# NOTE: this needs to correspond with parse-packages! my @lines; - my $regex; - if ($opts->{case_bool}) { - if ($opts->{exact}) { - $regex = qr/\b\Q$keyword\E\b/o; - } else { - $regex = qr/\Q$keyword\E/o; - } - } else { - if ($opts->{exact}) { - $regex = qr/\b\Q$keyword\E\b/io; - } else { - $regex = qr/\Q$keyword\E/io; - } + $keyword =~ tr [A-Z] [a-z]; + if ($opts->{exact}) { + $keyword = " $keyword "; } + $keyword =~ s/[(),.-]+//og; + $keyword =~ s#[^a-z0-9_/+]+# #og; open DESC, '<', "$file" or die "couldn't open $file: $!"; while () { - $_ =~ $regex or next; + next if index $_, $keyword < 0; debug( "Matched line $.", 2); push @lines, $.; }