Skip to main content.
home | support | download

Back to List Archive

Re: Almost

From: Lou Hevly <soc(at)>
Date: Fri Jul 16 2004 - 20:43:43 GMT
Hola (Greetings), John Wentworth! A(t) 18:11 16/07/04, vau escriure 
(you wrote):
>Thomas Dowling wrote:
> >I basically like the contents of the swish.cgi script for search
> >and I do not want to modify it alot but I would like to add one 
> feature =
> >I would like the drop the search terms and the result of the search 
> =
>into =3D


I'm using a slightly modified version of the module 
to do just this.  Under "use CGI;" add

use Storable;
my $db = './search.db';
unless (-e $db) {
  open DB, ">$db" or die $!;
  close DB;
my $ref;
if (-z $db) {$ref = {}} else {$ref = retrieve $db};
my $now = time;

Then, in the show_template sub (lines 15-25 or so):

     my $q = $results->CGI;
+   $ref->{$now}{query} = ${$q->{query}}[0];

    if ( $results->results ) {
+       $ref->{$now}{good}++;
         $output .=  results_header( $results );
         $output .=  show_result( $results, $_ ) for @{ 
$results->results };

It returns a record of all queries, when they were made, and whether 
they returned a positive result or not.  I use a separate script to 
retrieve and mung the data from search.db.


All the best (Adéu-siau),
Lou Hevly
Received on Fri Jul 16 13:44:07 2004