Modified to use Search.pm and KeywordSearch().
authortonnesen <tonnesen>
Fri, 10 May 2002 22:18:48 +0000 (22:18 +0000)
committertonnesen <tonnesen>
Fri, 10 May 2002 22:18:48 +0000 (22:18 +0000)
Note that I had to modify Search.pm as well to get it to return something other than that bizarre @stuff array.  :)

html-template/cmsdsearchresults.tmpl
html-template/search.pl

index f857d0b..bf69663 100644 (file)
@@ -4,12 +4,12 @@
 <body>
 <TMPL_INCLUDE NAME="searchheader.tmpl">
 <table border=1>
-<tr><th>Title</th><th>Author</th><th>Notes</th></tr>
+<tr><th>Title</th><th>Author</th><th>Dewey</th></tr>
 <TMPL_LOOP NAME=SEARCH_RESULTS>
   <tr>
   <td> <TMPL_VAR NAME=title> </td>
   <td> <TMPL_VAR NAME=author> </td>
-  <td> <TMPL_VAR NAME=notes> </td>
+  <td> <TMPL_VAR NAME=dewey> </td>
   </tr>
 </TMPL_LOOP>
 <tr><td colspan=3><a href=search.pl?template=<TMPL_VAR NAME="template">&startfrom=<TMPL_VAR NAME="nextstartfrom">>Next Records</a></td></tr>
index 09e2e19..8bdf82e 100755 (executable)
@@ -4,6 +4,7 @@ use strict;
 require Exporter;
 use C4::Database;
 use CGI;
+use C4::Search;
  
 my $query=new CGI;
 
@@ -18,12 +19,19 @@ my $dbh=&C4Connect;
 
 my $template = HTML::Template->new(filename => $templatename, die_on_bad_params => 0);
 
-my @results;
-my $sth=$dbh->prepare("select * from biblio where author like 's%' order by author limit $startfrom,20");
-$sth->execute;
-while (my $data=$sth->fetchrow_hashref){    
-    push @results, $data;
-}
+##my @results;
+#my $sth=$dbh->prepare("select * from biblio where author like 's%' order by author limit $startfrom,20");
+#$sth->execute;
+#while (my $data=$sth->fetchrow_hashref){    
+#    push @results, $data;
+#}
+
+my $blah;
+my %search;
+$search{'keyword'}='bear';
+
+my ($count, $resultshash, @results) = &KeywordSearch(\$blah, 'intra', \%search, 20, $startfrom);
+
 
 
 
@@ -31,6 +39,6 @@ $template->param(startfrom => $startfrom);
 $startfrom+=20;
 $template->param(nextstartfrom => $startfrom);
 $template->param(template => $templatename);
-$template->param(SEARCH_RESULTS => \@results);
+$template->param(SEARCH_RESULTS => $resultshash);
 
 print "Content-Type: text/html\n\n", $template->output;