From: Frank Lichtenheld Date: Fri, 1 Feb 2008 01:03:46 +0000 (+0100) Subject: Various improvements to the search result comments X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=13565c2add3c1f4c501cf0cba64cac10537e2eac;p=deb%2Fpackages.git Various improvements to the search result comments Don't pretend we know how many results have been suppressed, we really have no idea (that's the whole point of short cutting the search). Don't declare we will display results when we wont. We have all the necessary information so use it. Add some useful links similar to what is on the search_contents site. --- diff --git a/lib/Packages/DoSearch.pm b/lib/Packages/DoSearch.pm index 9fa8d3d..4d86d51 100644 --- a/lib/Packages/DoSearch.pm +++ b/lib/Packages/DoSearch.pm @@ -13,7 +13,7 @@ use Deb::Versions; use Packages::Search qw( :all ); use Packages::CGI qw( :DEFAULT ); use Packages::DB; -use Packages::Config qw( $DBDIR @SUITES @ARCHIVES $ROOT ); +use Packages::Config qw( $DBDIR @SUITES @ARCHIVES @ARCHITECTURES $ROOT ); sub do_search { my ($params, $opts, $page_content) = @_; @@ -30,7 +30,12 @@ sub do_search { my @keywords = @{$opts->{keywords}}; my $searchon = $opts->{searchon}; - $page_content->{search_keywords} = \@keywords; + $page_content->{search_keywords} = $opts->{keywords}; + $page_content->{all_architectures} = \@ARCHITECTURES; + $page_content->{all_suites} = \@SUITES; + $page_content->{search_architectures} = $opts->{arch}; + $page_content->{search_suites} = $opts->{suite}; + $page_content->{sections} = $opts->{section}; my $st0 = new Benchmark; my (@results, @non_results); diff --git a/templates/html/search.tmpl b/templates/html/search.tmpl index f7eace5..452e80b 100644 --- a/templates/html/search.tmpl +++ b/templates/html/search.tmpl @@ -30,17 +30,43 @@
[% UNLESS results %] -

[% g('You can try a different search on the Packages search page.', - searchformurl) %]

- [% IF opts.searchon != "names" && opts.exact %]

[% g('You have searched only for words exactly matching your keywords. You can try to search allowing subword matching.', make_search_url('',"keywords=$keyword_esc",'exact',0) ) %]

[% END %] [% END %] + +

[% g('Search in specific suite:') %] +[% FOREACH s IN all_suites %] + [% IF s != suite_str %] + [[% s %]] + [% ELSE %] + [[% s %]] + [% END %] +[% END %] +[% IF search_suites.size == 1 %] +

[% g('Search in all suites', + make_search_url('',"keywords=$keyword_esc",'suite','all')) %] +[% END %] + +

[% g('Limit search to a specific architecture:') %] +[% FOREACH a IN all_architectures %] + [% IF a != arch_str %] + [[% a %]] + [% ELSE %] + [[% a %]] + [% END %] +[% END %] +[% IF search_architectures.size == 1 %] +

[% g('Search in all architectures', + make_search_url('',"keywords=$keyword_esc",'arch','any')) %] +[% END %] + +

+ [% IF opts.searchon == "names" && non_results %] -

[% g('%u results have not been displayed due to the search parameters.', - "$search_url$keyword_esc", non_results) %]

+

[% g('Some results have not been displayed due to the search parameters.', + "$search_url$keyword_esc") %]

[% END %] @@ -71,11 +97,16 @@ [% IF opts.searchon != "names" %]

[% g("Note that this only shows the best matches, sorted by relevance. If the first few packages don't match what you searched for, try using more keywords or alternative keywords.") %]

[% ELSE %] -

[% g('Your search was too wide so we will only display exact matches. At least %u results have been omitted and will not be displayed. Please consider using a longer keyword or more keywords.', - too_many_hits) %]

+

+[%- IF results %] +[% g("Your keyword was too generic, for optimizing reasons some results might have been supressed.
Please consider using a longer keyword or more keywords.") %] +[%- ELSE -%] +[% g("Your keyword was too generic.
Please consider using a longer keyword or more keywords.") %] +[% END -%] +

[% END; END %] -[% UNLESS results %] +[% UNLESS results || too_many_hits %]

[% g('Sorry, your search gave no results') %]

[% END %]