From c50e864ca32bb02c14729adcbdb7be6ed2ef9663 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Tue, 17 Jul 2012 21:33:09 +0200 Subject: [PATCH] Redirect to man page if there's only one search result --- www/index.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/www/index.pl b/www/index.pl index 20b04d4..2b14b2a 100755 --- a/www/index.pl +++ b/www/index.pl @@ -214,6 +214,8 @@ sub browsesearch { my $q = $self->reqGet('q')||''; my $man = $self->dbSearch($q, 150); + return $self->resRedirect("/$man->[0]{name}.".substr($man->[0]{section},0,1), 'temp') if @$man == 1; + $self->htmlHeader(title => 'Search results for '.$q); h1 'Search results for '.$q; txt 'Note: This is just a simple case-insensitive prefix match on the man names. In the future we\'ll have more powerful search functionality. Hopefully.';