--- browser.cgi.orig	Mon Jan  1 15:11:12 2007
+++ browser.cgi	Tue Mar 27 09:09:39 2007
@@ -159,11 +159,46 @@
                 FROM     package
             })->hashes();
         }
+        $html .= "<table class=\"search\">\n";
+        $html .= "  <tr>\n";
+        $html .= "    <td>"; $html->fold("search-keyword1"); $html .= "</td>\n";
+        $html .= "    <td>"; $html->fold("search-package1"); $html .= "</td>\n";
+        $html .= "  </tr>\n";
+        $html .= "  <tr>\n";
+        $html .= "    <td>"; $html->fold("search-keyword2"); $html .= "</td>\n";
+        $html .= "    <td>"; $html->fold("search-package2"); $html .= "</td>\n";
+        $html .= "  </tr>\n";
+        $html .= "</table>\n";
+        $html >> "search-keyword1";
+        $html << 1;
+        $html >> "search-keyword2";
+        $html .= "<p/><b>Multi Keyword Exact Search:</b><br/>";
+        $html .= $cgi->start_form(-method => "GET", -action => $cgi->url(-relative => 1));
+        $html .= "<div>";
+        $html .= $cgi->textfield(-name => "search", -value => "web server -apache");
+        $html .= $cgi->hidden(-name => "form", -value => "search-keyword");
+        $html .= $cgi->submit(-name => "submit", -value => "Search");
+        $html .= "</div>";
+        $html .= $cgi->end_form();
+        $html << 1;
+        $html >> "search-package1";
+        $html << 1;
+        $html >> "search-package2";
+        $html .= "<p/><b>Package Name Fuzzy Search:</b><br/>";
+        $html .= $cgi->start_form(-method => "GET", -action => $cgi->url(-relative => 1));
+        $html .= "<div>";
+        $html .= $cgi->textfield(-name => "search", -value => "apache");
+        $html .= $cgi->hidden(-name => "form", -value => "search-package");
+        $html .= $cgi->submit(-name => "submit", -value => "Show");
+        $html .= "</div>";
+        $html .= $cgi->end_form();
+        $html << 1;
+        $html .= "<hr>\n";
+        $html .= "<h2>Previous Search Result</h2>\n";
         if (@rec == 0) {
             $html .= "No packages were found.<p/>";
         }
         else {
-            $html .= "The following packages were found:<p/>";
             $html .= "<table style=\"border-collapse: collapse;\">\n";
             foreach my $rec (sort { $a->{'package'} cmp $b->{'package'} } @rec) {
                 $html .= sprintf("<tr><td><a class=\"package\" href=\"%s?package=%s\">%s</a>&nbsp;&nbsp;</td><td>%s</td></tr>\n",
@@ -187,7 +222,43 @@
             exit(0);
         }
         else {
-            $html .= "ERROR: OpenPKG package \"$package\" not found!<p/>";
+            $html .= "<table class=\"search\">\n";
+            $html .= "  <tr>\n";
+            $html .= "    <td>"; $html->fold("search-keyword1"); $html .= "</td>\n";
+            $html .= "    <td>"; $html->fold("search-package1"); $html .= "</td>\n";
+            $html .= "  </tr>\n";
+            $html .= "  <tr>\n";
+            $html .= "    <td>"; $html->fold("search-keyword2"); $html .= "</td>\n";
+            $html .= "    <td>"; $html->fold("search-package2"); $html .= "</td>\n";
+            $html .= "  </tr>\n";
+            $html .= "</table>\n";
+            $html >> "search-keyword1";
+            $html << 1;
+            $html >> "search-keyword2";
+            $html .= "<p/><b>Multi Keyword Exact Search:</b><br/>";
+            $html .= $cgi->start_form(-method => "GET", -action => $cgi->url(-relative => 1));
+            $html .= "<div>";
+            $html .= $cgi->textfield(-name => "search", -value => "web server -apache");
+            $html .= $cgi->hidden(-name => "form", -value => "search-keyword");
+            $html .= $cgi->submit(-name => "submit", -value => "Search");
+            $html .= "</div>";
+            $html .= $cgi->end_form();
+            $html << 1;
+            $html >> "search-package1";
+            $html << 1;
+            $html >> "search-package2";
+            $html .= "<p/><b>Package Name Fuzzy Search:</b><br/>";
+            $html .= $cgi->start_form(-method => "GET", -action => $cgi->url(-relative => 1));
+            $html .= "<div>";
+            $html .= $cgi->textfield(-name => "search", -value => "apache");
+            $html .= $cgi->hidden(-name => "form", -value => "search-package");
+            $html .= $cgi->submit(-name => "submit", -value => "Show");
+            $html .= "</div>";
+            $html .= $cgi->end_form();
+            $html << 1;
+            $html .= "<hr>\n";
+            $html .= "<h2>Previous Search Result</h2>\n";
+            $html .= "OpenPKG package \"$package\" not found!<p/>";
             my $query = sprintf("upper(package) LIKE '\%\%%s\%\%'", escape("sql", uc($package)));
             for (my $i = 0; $i < length($package)-1; $i++) {
                 my $p = uc($package);
@@ -259,6 +330,42 @@
         $n++;
     }
 
+    $html .= "<table class=\"search\">\n";
+    $html .= "  <tr>\n";
+    $html .= "    <td>"; $html->fold("search-keyword1"); $html .= "</td>\n";
+    $html .= "    <td>"; $html->fold("search-package1"); $html .= "</td>\n";
+    $html .= "  </tr>\n";
+    $html .= "  <tr>\n";
+    $html .= "    <td>"; $html->fold("search-keyword2"); $html .= "</td>\n";
+    $html .= "    <td>"; $html->fold("search-package2"); $html .= "</td>\n";
+    $html .= "  </tr>\n";
+    $html .= "</table>\n";
+    $html >> "search-keyword1";
+    $html << 1;
+    $html >> "search-keyword2";
+    $html .= "<p/><b>Multi Keyword Exact Search:</b><br/>";
+    $html .= $cgi->start_form(-method => "GET", -action => $cgi->url(-relative => 1));
+    $html .= "<div>";
+    $html .= $cgi->textfield(-name => "search", -value => "web server -apache");
+    $html .= $cgi->hidden(-name => "form", -value => "search-keyword");
+    $html .= $cgi->submit(-name => "submit", -value => "Search");
+    $html .= "</div>";
+    $html .= $cgi->end_form();
+    $html << 1;
+    $html >> "search-package1";
+    $html << 1;
+    $html >> "search-package2";
+    $html .= "<p/><b>Package Name Fuzzy Search:</b><br/>";
+    $html .= $cgi->start_form(-method => "GET", -action => $cgi->url(-relative => 1));
+    $html .= "<div>";
+    $html .= $cgi->textfield(-name => "search", -value => "apache");
+    $html .= $cgi->hidden(-name => "form", -value => "search-package");
+    $html .= $cgi->submit(-name => "submit", -value => "Show");
+    $html .= "</div>";
+    $html .= $cgi->end_form();
+    $html << 1;
+    $html .= "<hr>\n";
+
     $html .= "<h2>Package Browsing</h2>\n";
     $html .= "Browse for currently <b>$n</b> packages in OpenPKG-CURRENT by their groups. ";
     $html .= "Packages are annotated with their short summary and quality class information (legend: ";
@@ -323,7 +430,25 @@
     $html .= "  </tr>\n";
     $html .= "</table>\n";
 
-    $html .= "<h2>Package Searching</h2>\n";
+    
+}
+elsif ($package) {
+    ##
+    ##  SHOW PACKAGE
+    ##
+
+    my $package = $cgi->param("package") || die;
+    $package =~ s/[^a-zA-Z0-9-]//sg;
+    my $pkg = $db->query(q{
+        SELECT   *
+        FROM     package
+        WHERE    package = ?;
+    }, $package)->hash();
+    if (not defined($pkg)) {
+        print $cgi->redirect(-uri => $cgi->url(-absolute => 1));
+        exit(0);
+    }
+
     $html .= "<table class=\"search\">\n";
     $html .= "  <tr>\n";
     $html .= "    <td>"; $html->fold("search-keyword1"); $html .= "</td>\n";
@@ -335,23 +460,21 @@
     $html .= "  </tr>\n";
     $html .= "</table>\n";
     $html >> "search-keyword1";
-    $html .= "Search for one or more packages by entering one or more keywords (all have to match exactly except for upper/lower case, use '-' to negate):";
     $html << 1;
     $html >> "search-keyword2";
-    $html .= "<p/><b>Keywords:</b><br/>";
+    $html .= "<p/><b>Multi Keyword Exact Search:</b><br/>";
     $html .= $cgi->start_form(-method => "GET", -action => $cgi->url(-relative => 1));
     $html .= "<div>";
-    $html .= $cgi->textfield(-name => "search", -value => "web server");
+    $html .= $cgi->textfield(-name => "search", -value => "web server -apache");
     $html .= $cgi->hidden(-name => "form", -value => "search-keyword");
     $html .= $cgi->submit(-name => "submit", -value => "Search");
     $html .= "</div>";
     $html .= $cgi->end_form();
     $html << 1;
     $html >> "search-package1";
-    $html .= "Lookup a particular package by its name (some fuzziness and case insensitivity are applied during matching):";
     $html << 1;
     $html >> "search-package2";
-    $html .= "<p/><b>Package Name:</b><br/>";
+    $html .= "<p/><b>Package Name Fuzzy Search:</b><br/>";
     $html .= $cgi->start_form(-method => "GET", -action => $cgi->url(-relative => 1));
     $html .= "<div>";
     $html .= $cgi->textfield(-name => "search", -value => "apache");
@@ -360,26 +483,8 @@
     $html .= "</div>";
     $html .= $cgi->end_form();
     $html << 1;
-    
-}
-elsif ($package) {
-    ##
-    ##  SHOW PACKAGE
-    ##
-
-    my $package = $cgi->param("package") || die;
-    $package =~ s/[^a-zA-Z0-9-]//sg;
-    my $pkg = $db->query(q{
-        SELECT   *
-        FROM     package
-        WHERE    package = ?;
-    }, $package)->hash();
-    if (not defined($pkg)) {
-        print $cgi->redirect(-uri => $cgi->url(-absolute => 1));
-        exit(0);
-    }
-
-    $html .= "<h2>Package Details</h2>\n";
+    $html .= "<hr>\n";
+    $html .= "<h2>Search Result Package Details</h2>\n";
     $html .= "The following summary information is known about the \"$package\" package.";
     $html .= "<p/>\n";
     $html .= "<table class=\"package\">\n";
