commit 3766ec077186added79396d0db129c8fff14f5fd
parent 1c0a906205e2cffcdd5bb1430cf4a65effba2c3c
Author: Kyle Milz <kyle@getaddrinfo.net>
Date: Sat, 8 Nov 2014 13:07:33 -0700
search: increase search space and display more information
Diffstat:
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/html/search.html b/html/search.html
@@ -3,7 +3,7 @@
%]</b>:</p>
[% FOREACH part_num IN results %]
- [% part_num.0 %]<br>
+ [% part_num.1 %] [% part_num.2 %] ([% part_num.0 %])<br>
<object data="/svg/[% part_num.0 %].svg" type="image/svg+xml">
</object>
[% END %]
diff --git a/search.pl b/search.pl
@@ -28,8 +28,9 @@ my $config = {
};
my $template = Template->new($config);
-my $query = "select part_num from products where description like ? or part_num like ?";
-my $search_sth = $dbh->prepare($query);
+my $sql = "select part_num, manufacturer, description from products " .
+ "where description like ? or part_num like ? or manufacturer like ?";
+my $search_sth = $dbh->prepare($sql);
while ($request->Accept() >= 0) {
print "Content-Type: text/html\r\n\r\n";
@@ -40,7 +41,7 @@ while ($request->Accept() >= 0) {
my (undef, $input) = split("=", $ENV{QUERY_STRING});
- $search_sth->execute("%$input%", "%$input%");
+ $search_sth->execute("%$input%", "%$input%", "%$input%");
my $products = $search_sth->fetchall_arrayref();
my $vars = {