Perhaps something like this?

<cfquery name="search" datasource="ds">
 Select someFields
 from someTable
 where
 <cfset x=0>
 <cfloop list="#form.search#" index="searchItem" delimiters=" ">
        <Cfset x=x+1>
        <cfif x gt 1>AND</cfif> searchField Like '%#searchItem#%'
 </cfloop>
</cfquery>

-----Original Message-----
From: Ben Densmore [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 09, 2004 10:48 AM
To: CF-Talk
Subject: Using Like Keyword for searching

I'm building in somewhat of a keyword search into a site I'm working
on. The search basically looks at what was typed into the search
field, does a query on a particular field in the database using the
like keyword and then returns a code or codes that is associated with
that particular field in the database.

The issue I'm having is if the value that is sotred in the db is something
like 
Cases: 24" - 30" and a person types in 24" cases in the search field
the query doesn't find anything.

My query looks like:
<cfquery name="search" datasource="ds">
 Select someFields
 from someTable
 where
 searchField Like '%#form.search#%'
</cfquery>

Now if you type 24 or 24" for example it will return the Cases: 24" - 30".

I wanted to do either a verity or Full text search but the client
doesn't want me to. Does anyone have any ideas on what I can do to get
the query to find anything that matches what is typed in?

Thanks,
Ben



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183736
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to