Share This Page With Your Favorite Service!
Digg! Reddit! Del.icio.us! Google! Live! Facebook! Slashdot! Netscape! Technorati! StumbleUpon! Spurl! Wists! Simpy! Newsvine! Blinklist! Furl! Fark! Blogmarks! Yahoo! Smarking! Netvouz! Shadows! RawSugar! Ma.gnolia! PlugIM! Squidoo! BlogMemes! FeedMeLinks! BlinkBits! Tailrank! linkaGoGo!
Mutli-Word search for best result

Have you even wanted to search for multiple words in a search (but as separate elements)? If a user typed in:

"ColdFusion MX Tutorials"

in a search box, this tutorial will show you how to accuretly return results from your data, where each individual word is filtered from the data...

<CFQUERY NAME="searchresults" DATASOURCE="yourdatasource">
    SELECT *
    FROM table
    WHERE 0=0
    AND

(
<cfloop index="i" list="#form.searchkeyword#" delimiters=" ">
    <cfoutput>
fieldname LIKE '%#i#%' AND </cfoutput>
</cfloop>
'%%')

</CFQUERY>

it is so simple ......



All ColdFusion Tutorials By Author: Ayhan Yildiz
  • Mutli-Word search for best result
    We think that we have the right search function! But we don't have. Lets see I what I am trying to say. For example: You are trying to find a tutorial about javascript validation. when you search "javascript validation" results comes "0". But they have tutorial about validation and they stored it as "JavaScript Form Validation". If you want to see it at search result page you must write in order as it is in database or indexes.. let's see how we can get correct search results.
    Author: Ayhan Yildiz
    Views: 11,515
    Posted Date: Monday, April 5, 2004