Whoops. Posted this by itself.

====================================
Treat the phrase/list of keywords coming in as a list: 

<cfset keywords = " help me           now"> 
<!--- assign to variable (TRIM! to remove lead/trailing spaces) ---> 
<cfset searchPhrase = #trim(keywords)#> 
<!--- replace all space/multiple spaces with comma [delimiter] ---> 
<cfset searchPhrase = #REreplaceNoCase(searchPhrase, "[  ]+", ",", "ALL")#> 

<!--- use this for your query to generate the Constraints ---> 
<cfloop from="1" to="#listLen(searchPhrase)#" index="counter"> 
  AND columnName LIKE '%#listGetAt(searchPhrase,counter)#%' 
</cfloop> 

This code will produce the following code: 

AND columnName LIKE '%help%' 
AND columnName LIKE '%me%' 
AND columnName LIKE '%now%' 

Use the listLen function to get number of keywords if you still need that. 

Obviously, adjust the code for "OR" instead of "AND" etc, but you get the idea.
========================================


>lets say, a user enters "skateboarding atlanta half-pipe"
>and you wanted to break that up into separate words, and know that
>there should be 3 "...or searchTerm like '%wordHere%'" sections in a
>query
> (one for each word) so that the user can search for "skateboarding or
>atlanta or
>half-pipe" through a sql statement.
>
>is this feasible, i know it has to be, just cant think past my keyboard
>right now.
>
>thanks for any ideas....
>
>....tony
>
>tony weeg
>[EMAIL PROTECTED]
>www.revolutionwebdesign.com
>rEvOlUtIoN wEb DeSiGn
>410.334.6331 
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Reply via email to