set_sql and like '%$searchTerm%'

[prev] [thread] [next] [Date index for 2004/09/14]

From: Michael Jensen
Subject: set_sql and like '%$searchTerm%'
Date: 20:03 on 14 Sep 2004
I have a weird search problem. I have set_sql working just fine. This 
may or may not be a direct CDBI issue. I have some files that I want to 
search for by keyword in a join.

$searchTerm is my search term coming in. I have a file name that works 
on some terms and not on others:

12091209_human_spla2_ratmouse_sites.tiff

If I search for "human" it doesn't come up. If I search for "\human" it 
does. "rat" works, "mouse" works, "ouse" doesn't work.

These only work when I use a \ in front:

spla2
ouse
human
uman
pla2

Here is the code within my page:


Table::Files->set_sql(full2a_srch => qq|select f.* from files f, texts 
t where (f.user_id=$filesUserID AND f.id=t.file_id AND (f.file like 
"%$searchTerm%" OR t.line_1 like "%$searchTerm%" OR t.line_2 like 
"%$searchTerm%" OR t.line_3 like "%$searchTerm%" OR t.body like 
"%$searchTerm%")) order by create_date desc limit $p,$limit|);

my @list2aQuery = Table::Files->search_full2a_srch();


What is up with this? I am using Mason (Perl), but this is within 
<%perl></%perl> tags so it basically just run straight perl.

Any ideas?

-Michael Jensen


set_sql and like '%$searchTerm%'
Michael Jensen 20:03 on 14 Sep 2004

Re: set_sql and like '%$searchTerm%'
William McKee 12:37 on 15 Sep 2004

Re: set_sql and like '%$searchTerm%'
Perrin Harkins 15:25 on 15 Sep 2004

Re: set_sql and like '%$searchTerm%'
Michael Jensen 17:43 on 15 Sep 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52