Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Global serch terms not working

Quote Reply
Global serch terms not working
Hi,

I've updatet from 2 to 3.1 and it's all working but one global not. Here's the code:
Code:
top10_search:
sub {
# Displays last 10 search terms.
my $tags = shift;
my $table = $DB->table('SearchLogs');
$table->select_options ('ORDER BY HitCount DESC', 'LIMIT 10');
my $len = 22;
my $cond = GT::SQL::Condition->new('char_length(Term)', '<', $len);
$cond->add('Results','>',0);
my $sth = $table->select($cond);
my @output;
while (my $link = $sth->fetchrow_hashref) {
push (@output, $link);
}
return { top10_search_loop => \@output };
}

I've checked the field names seem to be correct.

Kai
___________________________________________
http://www.westalgarve.de
http://www.portugalforum.org
http://www.portugal-links.de
Quote Reply
Re: [kailew] Global serch terms not working In reply to
I believe HitCount should be slog_hits

Term should be slog_query
Quote Reply
Re: [rascal] Global serch terms not working In reply to
In Reply To:
I believe HitCount should be slog_hits

Term should be slog_query

Hi,

I've changed it to

Code:
sub {
# Displays last 10 search terms.
my $tags = shift;
my $table = $DB->table('SearchLogs');
$table->select_options ('ORDER BY slog_hits DESC', 'LIMIT 10');
my $len = 22;
my $cond = GT::SQL::Condition->new('char_length(slog_query)', '<', $len);
$cond->add('Results','>',0);
my $sth = $table->select($cond);
my @output;
while (my $link = $sth->fetchrow_hashref) {
push (@output, $link);
}
return { top10_search_loop => \@output };
}

and understand the changings but it didn't work.

Kai
___________________________________________
http://www.westalgarve.de
http://www.portugalforum.org
http://www.portugal-links.de
Quote Reply
Re: [kailew] Global serch terms not working In reply to
Hi,

I know where the mistake is:

Code:
$cond->add('Results','>',0);

This should block displaying search terms without any result in the database ... if I comment it out, it works. But I like this feature ... ;)

Kai
___________________________________________
http://www.westalgarve.de
http://www.portugalforum.org
http://www.portugal-links.de
Quote Reply
Re: [kailew] Global serch terms not working In reply to
Hi,

May be you want to change it to:

Code:
$cond->add('slog_hits','>',0);

Wink

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] Global serch terms not working In reply to
great, that did it.

Thx!

Kai
___________________________________________
http://www.westalgarve.de
http://www.portugalforum.org
http://www.portugal-links.de
Quote Reply
Re: [kailew] Global serch terms not working In reply to
I know Tongue

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins