Gossamer Forum
Quote Reply
global search question
I use this global to see where there is the same phrase in the Database. Now I have problem that some of the phrase have title with 2 or 3 different option like
phrase - Saw V – SawV Saw number 5
So if I try to search it will not find any title with this phrase even if I have one call Saw V. is there an option to cat the phrase after every "-" and to see if there is a title in the database like Saw V or SawV or Saw number 5



sub {
use GT::SQL::Condition;
my $user = $_[0];
my $id = $_[1];
my $catid = $_[2];
my $tbl = $DB->table('CatLinks','Links');
$tbl->select_options('ORDER BY Title');
my $cond = new GT::SQL::Condition;
$cond->add('isValidated','=','Yes');
$cond->add('Title' => Like => "%$user%");
if ($catid) {
my $all_ids = $DB->table('Category')->children($catid);
$cond->add('CategoryID','IN',\@$all_ids); }
my $sth = $tbl->select( $cond ) || return $GT::SQL::error;
my $seen;
my @back;
while (my $hit = $sth->fetchrow_hashref) {
if ($seen->{$hit->{ID}}) { next }
$seen->{$hit->{ID}} = 1;
push @back, $hit;
} my $exists; if ($back[0]) { $exists = 1; } else { $exists = ''; }
return { user_link_loop => \@back, exists => $exists }; }

Subject Author Views Date
Thread global search question nir 2828 Nov 9, 2008, 6:01 AM
Post Re: [nir] global search question
Andy 2700 Nov 9, 2008, 11:59 PM