Gossamer Forum
Quote Reply
SearchLogger PlugIn Mod
hello!

The plug in works pretty good as is.... but on my site, I have searches for specific fields in the database- and these are used a LOT. Thus, when someone searches Title, query ($query) is null (because we are searching title only...)

Anyway, I get the most hits fro a null term.... and I wanted to mod SearchLogger to NOT log anything where query is null. Sounds easy, right?

This is what I tried:

In Reply To:
my $opts = shift;
my $db = $DB->table ('SearchLog');
my $query = $IN->param('query');
my $results = defined $opts->{link_hits} ? int($opts->{link_hits}) : 0;

$query =~ s/^\s*|\s*$//g;
$query = lc $query;
$query = substr ($query, 0, 24);
if ($query) {
my $hit = $db->get ($query);
if ($hit) {
$hit->{HitCount}++;
$hit->{Results} = $results;
$hit->{Last_Hit} = \"NOW()";
delete $hit->{Last_Hit};
$db->modify ($hit);
}
else {
$db->insert ( { Term => $query, HitCount => 1, Results => $results, Last_Hit => \"NOW()"});
}
return $opts;
}
}
else {
}
but thaT DOES NOT SEEM TO WANT TO WORK.... ANY IDEAS?

tia!

DAVE

Quote Reply
Re: SearchLogger PlugIn Mod In reply to
I can't see what you changed from the original....also what is going on at the end?

else {
}


Paul Wilson.
new - http://www.wiredon.net
Quote Reply
Re: SearchLogger PlugIn Mod In reply to
Paul:

Added the "if ($query) {" loop to run the plugin if query is not null...
dave