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('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 }; }

Quote Reply
Re: [nir] global search question In reply to

The short answer, is you can't really (without definding the different combinations somewhere)


Andy (mod)
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!