on 1/11/00 4:48 PM, Kay Smoljak at [EMAIL PROTECTED] wrote:

> 
> Thanks to everyone who replied, I figured it out - because I had
> '#form.keywords#%' it was only matching where the keyword was the first word
> in the field. I changed it to '%#form.keywords#%' and now it works fine. I'd
> still be interested in what people consider more efficient/faster than
> searching text fields this way.

The only problem with this is that it will not see multiple keywords as
individual words, but rather as a phrase. So "web design" will return "web
design" but not "web" or "design".

To search for all keywords you can do this:

<cfquery name="search" datasource="#dsn#">
select from news
where 1=1
<cfloop list="#form.keywords#" index="word" delimiters=" ">
and (news.article like '%#word#%'
or news.subtitle like '%#word#%'
or news.title like '%#word#%'
or news.keywords like '%#word#%')
</cfloop>
</cfquery>

-- 
 
Rob Keniger

big bang solutions

<mailto:[EMAIL PROTECTED]>
<http://www.bigbang.net.au>



------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to